DEV Community

Mahdi Abolfazli
Mahdi Abolfazli

Posted on • Updated on

Create alias in mac zsh

Let's see the steps without any further information:
1- check if we have bash or zsh:

echo $SHELL
Enter fullscreen mode Exit fullscreen mode

2- If it is zsh, open the file .zshenv (if it did not work, add them to .zshrc file):

vim .zshenv
Enter fullscreen mode Exit fullscreen mode

3- Add aliases here (I have created some aliases to use the git more efficiently):

alias g="git"
alias gl="git log"
alias gs="git status"
alias gcm="git commit -m"
alias gaa="git add ."
alias gpusho="git push origin"
alias gpullo="git pull origin"
alias gb="git branch"
alias gcb="git checkout -b"
Enter fullscreen mode Exit fullscreen mode

4- Close the terminal and open a new one to apply the effects.

DONE!

If we had bash instead of zsh, we should have used the bashrc file. To see the full video about this, you can watch this amazing video.

If you use any useful aliases, let me know in the comments!

Top comments (0)