[フレーム]
Last Updated: February 25, 2016
·
2.733K
· vraa

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/

AltStyle によって変換されたページ (->オリジナル) /