These aliases assume that the main git branch is called main
, per GitHub's standards starting October 2020. If you would like too keep legacy naming, or have a different name for your branch, set the GIT_MAIN_BRANCH environment variable at any point.
E.g. export GIT_MAIN_BRANCH=master
.
- Git status
- Git add and remove
- Git branch
- Git commit
- Git checkout
- Git fetch
- Git pull
- Git push
- Git rebase
- Git stash
- Git diff and log
- Back to main page
- g:
git status -sb
- ga:
git add
- gr:
git rm
- gb:
git branch -v
- gba: Shows the
git branch
es list sorted by the last commit time in ascending order - gbd: Shows the
git branch
es list sorted by the last commit time in descending order
- gc:
git commit
- gca:
git commit --amend
- gcm:
git commit -m
- gcod:
git checkout develop
- gcom:
git checkout ${GIT_MAIN_BRANCH-main}
- gcos:
git checkout staging
- gf:
git fetch
- gfa:
git fetch --all
- gp:
git pull --rebase
- gprod:
git pull --rebase origin develop
- gprom:
git pull --rebase origin ${GIT_MAIN_BRANCH-main}
- gpros:
git pull --rebase origin staging
- gprud:
git pull --rebase upstream develop
- gprum:
git pull --rebase upstream ${GIT_MAIN_BRANCH-main}
- gprus:
git pull --rebase upstream staging
- gpod:
git push origin develop
- gpom:
git push origin ${GIT_MAIN_BRANCH-main}
- gpos:
git push origin staging
- gpud:
git push upstream develop
- gpum:
git push upstream ${GIT_MAIN_BRANCH-main}
- gpus:
git push upstream staging
- gpofl:
git push --force-with-lease origin
- gpufl:
git push --force-with-lease upstream
- gra:
git rebase --abort
- grc:
git rebase --continue
- grd:
git rebase develop
- gri:
git rebase -i
- grm:
git rebase ${GIT_MAIN_BRANCH-main}
- grs:
git rebase staging
- gma:
git merge --abort
- gmc:
git merge --continue
- gmd:
git merge develop
- gmm:
git merge ${GIT_MAIN_BRANCH-main}
- gms:
git merge staging
- gsl:
git stash list
- gsp:
git stash pop
- gss:
git stash save
- gd:
git diff --color-words
- gl:
git log --oneline --decorate
- gslog: a nice superLog
git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all