jwir3
jwir3

Reputation: 6209

Is there a way to get git to autocomplete commands based on a shortened version?

When working for another company, I often used Mercurial for revision control. I actually like git better, but one thing that really annoys me is that in Mercurial, if I type:

hg stat

It is smart enough to realize that the only command that could have been in place of this is hg status, thus executing the command for me.

I know that git doesn't do this by default, but I would like it to. (BTW, I've read http://www.evanjones.ca/git-shortcuts.html and know about aliases, but I'd like to not have to setup an alias every time I want this behavior.)

I could probably write an addon for git that does this, but I'm wondering first if there's a way to configure git to recognize this is the behavior I want, and if not, is there already a plugin for this?

Upvotes: 3

Views: 102

Answers (2)

hunch_hunch
hunch_hunch

Reputation: 2331

You said you'd rather not set up aliases, but there are plenty of pre-made lists that you can copy/paste into your config. This is one such example.

Upvotes: 0

Eran
Eran

Reputation: 393866

Git Bash does autocomplete commands when you hit TAB. If there is more than one option for the prefix you type, hitting TAB twice will display all the options. It even auto completes branch names.

git stat will be completed to git status when you click TAB.

Upvotes: 1

Related Questions