[Tip] Git Alias

I use git on daily basis. Git can be a little verbose sometimes. It is impossible to remember all commands, and check the documentation takes a while.

Git support a mechanism to define custom commands called alias. Using alias you can easily create shortcut to other commands. You can use more complex commands or shorten typically used ones.

There is two ways to create an alias. You can use ‘git config’ to setup.
# 1. Create a short version of 'git status'
git config --global alias.st status

Or you can manually edit ~/.gitconfig and add it to [alias] block.
# 2. Edit ~/.gitconfig
[alias]
st = status

Next time you want to check the status of your repository just type:
git st

For more alias examples check this gist on my github account. Or this page on GitHowTo.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s