Git Commands Cheat Sheet
A practical Git reference for branches, commits, remotes, history, stashing and recovery.
Daily workflow
- git status
- git add .
- git commit -m "message"
- git pull --rebase
- git push
Branches
- git branch
- git switch -c feature/name
- git switch main
- git merge feature/name
- git branch -d feature/name
History & recovery
- git log --oneline --graph
- git diff
- git stash
- git restore FILE
- git reflog
Use these commands as a quick reference. Always review destructive commands before running them.