PowerShell + Git = posh-git

We want to have better command completion with Git from console.
We are lucky because of the posh-git

Now we can type git co – press Tab and get completion to git commit
or even more interesting git checkoutTab – can switch between available

Installation is very simple especially with PsGet

Install-Module posh-git

That’s it! đŸ™‚

There is a known bug very slow prompt return where you can have significant delay between commands. It is caused by git status updates on every command prompt.

I would recommend to turn the status off
Just add the following line into your PowerShell profile

$GitPromptSettings.EnableFileStatus = $false

There are several pull requests to the posh-git repository that supposed to help with the issue but they are still open.
Maybe I will try them by myself later.

I tried several two pull requests that had to fix the issue with long prompt return for large projects.
This one did not work for me at all. I have just lost status string completely.

But this one worked fine so I could enable status back.
Command prompt still hangs but now only if repository was changed which is acceptable.

To prepare working version

git clone git://github.com/dahlbyk/posh-git.git
cd posh-git
git remote add robertream git://github.com/robertream/posh-git.git
git fetch robertream
git merge robertream/master
# you will get a merge conflict
git mergetool
# resolve conflicts
git commit

Then you can copy content of the posh-git folder into c:\Documents\WindowsPowerShell\Modules\posh-git

And the last step…
Modify your PowerShell profile script and add


This will turn the feature on.

Also remove the following line you added it before

$GitPromptSettings.EnableFileStatus = $false

About mnaoumov

Senior .NET Developer in Readify
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

One Response to PowerShell + Git = posh-git

  1. Pingback: Guide how to easy screw up your git repository | mnaoumov.NET

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s