Vasu Patel logoVasu Patel
← Git Mastery
All chapters in this track
  1. 011. The Mental Model
  2. 022. Essential Setup
  3. 033. Core Daily Workflow
  4. 044. Branching
  5. 055. Merging & Conflict Resolution
  6. 066. Rebasing
  7. 077. Remote Repositories
  8. 088. Stashing
  9. 099. Undoing Things
  10. 1010. Tagging & Versioning
  11. 1111. Cherry-Pick
  12. 1212. Git Bisect & Blame
  13. 1313. Git Hooks
  14. 1414. Submodules
  15. 1515. Team Workflows
  16. 1616. Power Commands & Aliases
  17. 1717. Reflog: The Safety Net
  18. 1818. Practice Tasks
  19. 19Quick Reference Cheatsheet

Chapter 19 of 19

Quick Reference Cheatsheet

SETUP          git config --global user.name/email/editor
               git init | git clone <url>

DAILY          git status | git diff | git diff --staged
               git add -p | git add . | git commit -m ""
               git log --oneline --graph --all

BRANCH         git switch -c <name> | git branch -d <name>
               git branch -a | git branch --merged

MERGE          git merge <branch> | git merge --no-ff
               git merge --abort | git mergetool

REBASE         git rebase main | git rebase -i HEAD~N
               (never rebase shared/public branches)

REMOTE         git fetch | git pull --rebase | git push
               git push -u origin <branch>
               git remote -v | git branch -r

STASH          git stash push -m "name" | git stash pop
               git stash list | git stash drop

UNDO           git restore --staged <file>  (unstage)
               git restore <file>           (discard working dir)
               git reset --soft HEAD~1      (undo commit, keep staged)
               git reset HEAD~1             (undo commit, keep unstaged)
               git reset --hard HEAD~1      (undo commit, discard all)
               git revert HEAD              (safe undo for pushed commits)

TAG            git tag -a v1.0.0 -m "msg" | git push origin --tags

CHERRY-PICK    git cherry-pick <hash>

BISECT         git bisect start | git bisect bad | git bisect good <tag>
               git bisect reset

BLAME          git blame file | git log -S "term" -- file

REFLOG         git reflog | git reset --hard HEAD@{N}
               (your safety net — 90 day history of all HEAD movements)

Last updated: 2026-08-19