I've just started using a new kind of abbreviation system for Git:
- I use 'g' instead of 'git',
- I've set up bash autocompletion for 'g', just like 'git'.
Previously, I used the following in my ~/.bashrc:
... alias gts='git status' alias gtd='git diff' ...The problem is that, by doing this, you lose autocompletion.
Setup
Set Up 'g' as an alias for 'git'
In ~/.bashrc:
... alias g='git' ...
2. Locate the Bash Completion File for Git
Locate your bash_completion.d directory:
- On Linux, /etc/bash_completion.d
- I'm using OS X with Mac Ports, so mine is at /opt/local/etc/bash_completion.d.
git-completion.bash
3. Add Completion for 'g'
Add the following to the end of git-completion.bash
:
$ g |<TAB>you should see autocompletion:
$ g | add commit init request-pull am config instaweb reset annotate describe log revert ...