Git Aliases
Git is a version control tool used to track and manage source code files and changes to those files. In sharing some of my development tooling setup, I want to promote the use of git aliases as an “Express” route or shortcut to commonly used commands.
I don’t see enough people using them. People seem content to type out long commands that they use on a regular basis.
I just wanted to share a few of my favorite aliases here.
My Favorite Aliases
Git aliases are defined in the .gitconfig
file in your Home directory.
[alias]
b = branch
r = remote -v
s = status
co = checkout
uncommit = reset --soft HEAD^
amend = commit --amend
cp = cherry-pick -x
Example Usage
Instead of typing:
$ git checkout master
I can type:
$ git co master
Instead of:
$ git status
I only need to type:
$ git s
When I accidentally commit changes to the wrong branch, it’s so easy to just “uncommit” them.
$ git uncommit
Note: You should never uncommit something that has already been pushed to a remote.
What git aliases are your favorites?