Customize Powershell Prompt Message to Show Current Git branch name
function prompt{
$p = Split-Path (
Get-Location
) -Leaf
git branch | foreach{
if($_ -match "^\*(.*)"){
$p += " [" + $matches[1] + " ] "
}
}
$p = $p + ">"
Write-Host $p -NoNewline -ForegroundColor Green
return " "
}
Add above function in $PROFILE file. Save and Restart Powershell.
Source: http://veerasundar.com/blog/2013/05/customize-powershell-prompt-message/
Written by Veera
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Powershell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#