DEV Community

Paul Bennett
Paul Bennett

Posted on

Making Git easier with aliases in the terminal

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"
Enter fullscreen mode Exit fullscreen mode

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 manage.py runserver" # starts django server
alias dmm="python manage.py makemigrations" # makes db migrations in django
alias dm="python manage.py migrate" # migrates db in django
Enter fullscreen mode Exit fullscreen mode
alias gd="gatsby develop"
alias gb="gatsby build"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)