posh-git Release v0.3


On a whim, I’ve decided to tag a v0.3 release of posh-git (which has been stable for a few months now). In this release…

Installer

Previously the setup process for posh-git was undefined. Daniel Hoelbling was kind enough to put together a getting-started post, but I decided to make it even easier. Assuming Git and PowerShell are configured correctly (see readme for details), getting started is trivial:

cd C:\Wherever
git clone https://github.com/dahlbyk/posh-git.git
.\posh-git\install.ps1

At this point the sample posh-git profile will be loaded as part of your PowerShell profile. If you don’t like the sample profile, feel free to grab the pieces you want and discard the rest (so you can use posh-hg too, perhaps).

** If you already have posh-git installed, just cd into your posh-git directory and pull from my master branch:

# If you don't already have me as a remote...
git remote add dahlbyk
git pull --rebase dahlbyk master

You don’t need to run install.ps1 again; just open a new PowerShell session and you’re good to go.

Performance

By taking a dependency on msysgit 1.7.1, all status information is now retrieved in a single call (git status -s -b). This still means git status is called for every prompt, so if status is slow for your repository your prompt will be slow too.

If it’s still too slow for your taste, you also have the option to set $GitPromptSettings.EnableFileStatus = $false. This will preserve branch information for the prompt, but skip everything else (counts and tab completion for added/modified/deleted files).

Finally, you can set $GitPromptSettings.Debug = $true to see how long the various steps take behind the scenes. If your environment is anything like mine, the majority of the time will be spent in git calls.

Tab Expansion Updates

  • Fix for git rm during deleted/updated merge conflict
  • Branch expansion for cherry-pick, diff, difftool, log and show
  • Normal expansion through simple aliases (e.g. alias.dt = difftool supports git dt <tab>)

Next Steps

  • I’d still like to get some testing in place so I don’t break things unintentionally
  • I’m considering moving away from regex to parse commands for tab expansion — anyone feel like writing a git command parser in PowerShell?
  • I’d like it to be easier to use posh-git and posh-hg together, so I may revisit how they hook into tab expansion

As always, your feedback is appreciated. If you’d like posh-git updates between release posts, you can also follow me on Twitter.

Windows Git Tip: Hide ^M (Carriage Return) in Diff