In your command-line window, type the following:
git config --local alias.ad add git config --local alias.st status
Now open your .config
file, which is present inside the repository with your favorite text editor and you will see the following lines at the bottom:
[alias] ad = add st = status
We have successfully created aliases for the Git commands add
and status
. To verify this, switch back to your command-line window and type the command git st
and observe the output, which will be a spot on match to your git status
command . Similarly we can use git ad
as a substitute for the git add
command.
We can also chain two or more commands with one single alias. Let's learn how to do this.