A collection of useful aliases for git with completion.
At the moment support for bash and zsh is available. Defined aliases can likely be ported to other shells easily.
To use the aliases in bash you need to have the git-completion.bash script loaded in order to provide completion.
Copy the git-aliases.bash
file to a location (e.g. your home directory). Then add the following lines to your .bashrc
:
# Load git completion
source ~/.git-completion.bash
# Load git aliases
source ~/git-aliases.bash
After a restart of your shell or after issuing source ~/.bashrc
the aliases become available.
To use the aliases in zsh copy the git-aliases.zsh
file to a location (e.g. your home directory). Then add the following lines to your .zshrc
:
# Load git aliases
source ~/git-aliases.zsh
No loading of completion scripts is neccessary since zsh provides this functionality.
After a restart of your shell or after issuing source ~/.zshrc
the aliases become vailable.
After installation you can use the defined aliases like any other command.
The following basic aliases are defined:
Alias | Command |
---|---|
g | git |
gcl | git clone |
gpl | git pull |
gpu | git push |
gf | git fetch |
ga | git add |
gc | git commit |
gst | git stash |
grst | git reset |
gb | git branch |
gco | git checkout |
gcp | git cherry-pick |
gm | git merge |
grb | git rebase |
gt | git tag |
gl | git log |
gr | git remote |
gbs | git bisect |
In addition to the base aliases additional aliases are defined to provide common command usages. These are always prefixed with the base alias.
Some common examples:
Alias | Command |
---|---|
gss | git status --short |
gba | git branch --all |
gplum | git pull upstream master |
grbc | git rebase --continue |
gcob | git checkout -b |
For a complete list see the git-aliases.*
file.
Feel free to add your own aliases or shell ports by opening a pull request!