Aliasing git commands

Yep, you can do it in git.

So if you want to have customized names for some git commands, you can change it through the git config file.

Let’s say instead of running this command to unstage a file:

git reset HEAD config/environment.rb

you can alias ‘reset HEAD‘ and change it to ‘unstage‘ by:

git  config –global alias.unstage ‘reset HEAD’

and by that, you just unstage a file now by:

git unstage config/environment.rb

awesome huh? here’s the command:

git config –global alias.<alias_name> ‘<git command>’

 

 

Leave A Comment

Please be polite. We appreciate that. Your email address will not be published and required fields are marked