Skip to content

Instantly share code, notes, and snippets.

@rosado
Created July 13, 2010 12:41
Show Gist options
  • Save rosado/473798 to your computer and use it in GitHub Desktop.
Save rosado/473798 to your computer and use it in GitHub Desktop.
$git_repo_location = (get-location).Path
function Prompt () {
$location = $git_repo_location
$id = 1
$historyItem = Get-History -Count 1
if($historyItem)
{
$id = $historyItem.Id + 1
}
$branch = (git branch) | ? {$_.StartsWith("* ") } | %{ $_.Substring(2)}
$path = (Get-Location).Path.Replace($location, "")
Write-Host -NoNewline -ForegroundColor DarkGray "`n["
if($branch){
Write-Host -NoNewLine -ForegroundColor Cyan "{$branch}"
}
Write-Host -ForegroundColor DarkGray "$path]"
Write-Host -NoNewLine "PS:$id > "
$host.UI.RawUI.WindowTitle = "$path"
"`b"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment