Last active
November 23, 2019 17:34
-
-
Save taylorhutchison/6b2b84f5dc7915541a334b59181b1576 to your computer and use it in GitHub Desktop.
A powershell prompt function for showing current git branch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Prompt { | |
Write-Host "PS $($executionContext.SessionState.Path.CurrentLocation)" -NoNewline | |
$head = git symbolic-ref HEAD | |
if($null -ne $head) { | |
Write-Host " " -NoNewline | |
Write-Host "[$($head.substring($head.LastIndexOf("/") +1))]" -ForegroundColor Yellow -BackgroundColor Red -NoNewline | |
} | |
"$('>' * ($nestedPromptLevel + 1)) " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment