git.zsh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # preferred git shortcuts, not in the git plugin
  2. alias ga.='git add .'
  3. alias gs='git status'
  4. alias gd='git diff'
  5. alias gds='git diff --staged'
  6. alias gcob='git checkout -b'
  7. alias gf='git fetch --tags --prune'
  8. alias gbd='git branch -D'
  9. # standard log with train tracks
  10. alias gl='git log --graph --pretty="format:%C(yellow)%h%Cgreen%d %Cblue[%an] %Creset%s... %C(cyan)%ar"'
  11. # concise, branch and tag log with train tracks (some merge commits unavoidable)
  12. alias glb='git log --all --simplify-by-decoration --pretty="format:%C(yellow)%h%Cgreen%d %Cblue[%an] %Creset%s... %C(cyan)%ar"'
  13. alias glp='git log --patch'
  14. # useful when you want to have a visual on file changes
  15. alias gls='git log --graph --stat'
  16. # search through history for particular text
  17. alias glS='git log -S'
  18. alias gr='git reset'
  19. alias grh='git reset --hard'
  20. alias grs='git reset --soft'
  21. alias grb='git rebase'
  22. # useful for finding parent commit for a given commit hash
  23. alias gsr='git show --format=raw'
  24. # useful if you forget to setup tracking for a new branch when checking out.
  25. alias track='git branch --set-upstream $(current_branch) origin/$(current_branch) && git fetch'
  26. # useful omz git plugin ones include:
  27. # ga, gc, gco, gb, gba, gm, grhh, ggpull, ggpush
  28. #
  29. # ggpull translates into `git pull origin <current branch>`, same for ggpush
  30. #
  31. # Note: both the gg's are extremely convenient! And safe, because you never know
  32. # if tracking has been setup properly on a branch.