Skip to content

Instantly share code, notes, and snippets.

@dlech
Last active April 3, 2019 00:46
Show Gist options
  • Save dlech/6f6c3a74a959d5a0e10ea591e6956c4a to your computer and use it in GitHub Desktop.
Save dlech/6f6c3a74a959d5a0e10ea591e6956c4a to your computer and use it in GitHub Desktop.
git-posh customization
Import-Module posh-git
# show the git repo name in magenta (really the parent directory name)
$GitPromptSettings.DefaultPromptPrefix.Text = '$(@((git rev-parse --show-toplevel).Split("/"))[-1])'
$GitPromptSettings.DefaultPromptPrefix.ForegroundColor = [ConsoleColor]::Magenta
# show only the relative directory in the git repo
$GitPromptSettings.DefaultPromptPath = '\$(@($pwd.Path.Split("\") | Select-Object -Skip @((git rev-parse --show-toplevel).Split("/")).Length) -join "\")'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment