Skip to content
mnaoumov.dev
Go back

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 checkout - Tab - 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.

EDIT: 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

Start-GitPrompt

This will turn the feature on.

Also remove the following line you added it before

$GitPromptSettings.EnableFileStatus = $false

Share this post on:

Previous Post
Git and typos
Next Post
PsGet - NuGet for PowerShell