Jun 24, 2016 07:08
Mostly a note to self, this is how you can show your current git branch in Windows Powershell. Just add it to your profile.ps1.
function prompt{
$p = (Get-Location).path
git branch | foreach{
if($_ -match "^\*(.*)"){
$match = $matches[1] -replace '\s', ''
$p += " [" + $match + "]"
}
}
$p = $p + ">"
Write-Host $p -NoNewline
return " "
}
powershell