Simple git aliases for daily purpose
Kaushik Thirthappa
Posted on May 16, 2020
On average, every developer commits their code atleast once a day.
Having some git aliases
help you quickly make changes and push your code.
No more typos
One of my daily frustrations in the past π€¬ -
Avoid common pitfalls are super important, it helps increase productivity in the long term.
Table of contents
- git status
- git commit
- git push
- git add and commit
- git add, commit and push
- git stash
- git stash apply
- git push --set-upstream
- git checkout
ps: These are aliases I have been using personally, feel free to create and share your own βΊοΈ
1. git status π gs
Before -
git status
After -
gs
Setup code -
alias gs='git status'
2. git commit π gc
Before -
git commit -m 'Adding integration test cases'
After -
gc 'Adding integration test cases'
Setup code -
alias gc='git commit -m $2'
3. git push π gp
Before -
git push
After -
gp
Setup code -
alias gp='git push'
4. git add . && git commit -m π gac
Before -
git add .
git commit -m 'Adding integration test cases'
After -
gac 'Adding integration test cases'
Setup code -
alias gac='git add . && git commit -m $2'
5. git add . && git commit -m && git push π gacp
Before -
git add .
git commit -m 'Adding integration test cases'
git push
After -
gacp 'Adding integration test cases'
Setup code -
alias gacp='git add . && git commit -m $2 && git push'
6. git stash π gst
Before -
git stash
After -
gst
Setup code -
alias gst='git stash'
6. git stash apply π gsta
Before -
git stash apply
After -
gsta
Setup code -
alias gsta='git stash apply'
6. git push --set-upstream origin π gpst
This syntax is the one I forget the most π€·ββοΈ
Before -
git push --set-upstream origin integration-tests
After -
gpst integration-tests
Setup code -
alias gpst='git push --set-upstream origin $1'
6. git checkout π gco
Before -
git checkout staging
After -
gco staging
Setup code -
alias gco='git checkout $1'
These are the aliases that I use everyday for the past few years. No typos, no errors and super handy.
Posted on May 16, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.