The other day I was watching a video and noticed that when they would “git add” and “git commit” they would type “ga” and “gcm”. I became so intrigued by it. A way to type even less? Count me in!
Creating aliases in ZSH is pretty simple. First you need to open your .zshrc file. This file is located in your home directory on mac.
Once we have our .zshrc file open, we can add aliases. I just added mine to the bottom of the file.
The syntax for the config file is:
declaration variable name (what you want to type) = "the command you are doing"
So if we look at my first alias:
alias dev="cd ~/Development/"
I’m creating an alias called dev. When i type dev it will go to my Development directory from where ever I am in my terminal.
The next lines are my git commands that I don’t want to fully type out.
alias gcm="git commit -m"#i can now just type: gcm "commit message"alias ga="git add"#can add all using: ga .
Hopefully you find this information useful and save you a couple extra keystrokes per day!