git — How to define aliases in git — Big Fat Software, Inc.
1 min readDec 24, 2020
Create alias using the git config
command
Use the git config
command with the alias
followed by the command
you want to substitute
Example:
To create the alias p for git push:
git config --global alias.p 'push'
Usage:
git p
List all your aliases
git config --global -l
This command will list out all your config
properties associated with git. Since the aliases are git configurations too, they
$ git config --global -l
alias.co=checkout
alias.br=branch
alias.ci=commit
alias.st=status
alias.unstage=reset HEAD --
alias.p=push
Note:
Git aliases are not the same thing as UNIX aliases. Therefore, to use them, you have to use a command as if you are providing it as an argument to git like any other git-command.
For example:
$ git br
$ git co main
$ git unstage
$ git add ./src/app.js
$ git st
$ git ci
$ git p origin main
Originally published at http://bigfatsoftwareinc.wordpress.com on December 24, 2020.