So you recently moved to linux or have sarted developing on linux and
encountered the long git commands which you'd like to shorten, don't worry, why?
Because I got you my friend.
In Linux, setting aliases and making them permanent are a little bit easier than Windows Powershell.
Now in linux there exists multiple types of terminals since as you might have heard,
there are so many distributions out there each with its own or borrowed base.
Don't be scared I'll take your through the most common, the bash terminal
To create a permanent alias, we will need to edit the file ~/.bashrc for bash and ~/.zshrc for zsh
You can open this file with nano or your preferred text editor.
Here I will use vi as a text editor example.
vi ~/.bashrc
vi ~/.zshrc
At the bottom of this file, you can add your permanent git aliases.
These are just some examples, you coud create as many as you want.
#>>> git aliases >>>
alias ginit='git init'
alias clone='git clone'
alias fetch='git fetch'
alias merge='git merge'
alias push='git push'
alias pull='git pull'
alias add='git add'
alias commit='git commit -m'
alias checkout='git checkout'
alias branch='git branch'
alias diff='git diff'
alias show='git show'
alias gstat='git status'
#<<< git aliases <<<
After saving your changes and exiting the file, execute the following command to make the changes take effect:
source ~/.bashrc
source ~/.zshrc