tags:

views:

47

answers:

3

when inside a git repository, is it possible to add tab completion for git branches to Powershell? ie:

PS> git checkout ma<tab>

would result in

PS> git checkout master
+3  A: 

For that to be possible, a git provider for PowerShell would need to exist.

After a quick search, something similar apparently exists, the bizarre but aptly named posh-git:

http://github.com/dahlbyk/posh-git

A set of PowerShell scripts which provide Git/PowerShell integration

  • Prompt for Git repositories: The prompt within Git repositories can show the current branch and the state of files (additions, modifications,
    deletions) within.
  • Tab completion: Provides tab completion for common commands when using git. E.g. git ch<tab> --> git checkout

Usage

See profile.example.ps1 as to how you can integrate the tab completion and/or git prompt into your own profile. You can also choose whether advanced git commands are shown in the tab expansion or only simple/common commands. Default is simple.

fletcher
+1 not what I was looking for, but it looks like it could be expanded to do what I want.
Gabe Moothart
I thought I remembered it being possible to add the necessary stuff from msysgit to your path so you could run it from elsewhere?
Jefromi
+1  A: 

Here are some blog posts that explain how to do something like this:

http://www.jeremyskinner.co.uk/2010/03/07/using-git-with-windows-powershell/

http://www.markembling.info/view/git-powershell-revisited

Gabe Moothart
A: 

I wrote a generic provider for PowerShell whose behaviour can be implemented entirely in powershell script. This would be an ideal starting spot to prototype a GIT provider if one does not exist (or is dead, or insufficent.)

http://psprovider.codeplex.com

-Oisin

x0n
Thanks for the link, but git is a command-line tool. It doesn't strictly need a "provider", I can call it and parse the response directly.
Gabe Moothart
@gabe sure, but the idea would be that you wrap git's command line tool as a provider using psprovider.
x0n