Alias command

Writing long commands is boring. Making commands smaller or chaining of commands helps. This can be achieved using alias command. Alias command is mainly used for abbreviating a system command, or for adding default arguments to a regularly used command.

For example, instead of writing:

git add .  
git commit -m "COMMIT MESSAGE"
git push

we can write following to achieve the same goals.

gc "COMMIT MESSAGE"  
gp  

In the example, git commands were chained. Git doesn’t allow chaining using git alias command but we can simply overcome that by alias command as shown above. Do visit git-scm.com to evaluate what’s best for your use case.

Usage

For GNU/Linux (bash)

$ touch ~/.bash_aliases
alias gc='git add . && git commit -m '
alias gp='git push'

Note - no spaces between the alias target and alias input commands and single quotes only.

$ source ~/.bash_aliases

For Windows (Git Bash)

 cd ../../Program\ Files/Git/etc/profile.d/
nano aliases.sh
# CUSTOM ALIASES

alias gc='git add . && git commit -m'
alias gp='git push'

Note - no spaces between the alias target and alias input commands and single quotes only.

CTRL+O 
# PRESS ENTER
CTRL+X 

Use Cases

Some useful aliases can be:

alias update='sudo apt update && sudo apt upgrade'
alias rm='rm -i'
alias gc='git add . && git commit - '
alias gp='git push'
alias gr='git restore --staged'

My bash aliases can be found here.