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
# 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.
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
Tab Expansion Updates
- Fix for
git rmduring deleted/updated merge conflict
- Branch expansion for
- Normal expansion through simple aliases (e.g.
alias.dt = difftoolsupports
git dt <tab>)
- 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.