Making Git easier with aliases in the terminal

May 22nd, 2020 · 1 min read

Using aliases allow you as a terminal user to save time, It will end up saving a lot of time during the day. Instead of git status I type gs the rest are below and are self-explanatory.

alias gs="git status"
alias gp="git pull"
alias gb="git branch"
alias ga="git add ."
alias gc="git commit -m $1"
alias gca="git commit -a -m $1"
alias gpo="git push origin $1"

You're able to also use arguments with $1, $2, etc. for more extendability, like in this example:

alias gc="git commit -m $1"

Now, all I have to type is gc “Commit message” and it’ll commit my changes with the provided message.

All you have to do is find your most-used commands and try to make them shorter using an alias to make yourself more productive. For example below are some for Django and Gatsby workflows, you get the idea.

alias rs="python runserver" # starts django server
alias dmm="python makemigrations" # makes db migrations in django
alias dm="python migrate" # migrates db in django
alias gd="gatsby develop"
alias gb="gatsby build"
2021 @mrpbennett