Creating alias for GIT commands

Lets see a small tip that can make our Git experience more easier in dealing with Git commands by creating aliases.

By using aliases feature we can able to map the Git commands with our own set of languages (probably some decent words). 🙂

Here are few samples,

we can able to create alias by executing following commands in Git bash

$ git config –global alias.drag pull
$ git config –global alias.drop push
$ git config –global alias.st status

After setting alias, we can use the alias name instead of the Git command keyword.

For example,

If we wish to view the staus of repository, we can simply execute the following command

$ git st

Few more,

pandiyan@TARZAN MINGW64 /d/usr/Pandiyan/Repos/ElasticBridge (master)
$ git config –global alias.drag pull

pandiyan@TARZAN MINGW64 /d/usr/Pandiyan/Repos/ElasticBridge (master)
$ git drag
Already up-to-date.

pandiyan@TARZAN MINGW64 /d/usr/Pandiyan/Repos/ElasticBridge (master)
$

We can also edit them or add more by modifying the .gitconfig file directly:

[alias]
drag = pull
st = status

 

gitconfig

Just try out.
Happy coding !

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s