Type what you want to do. Get the exact command, why it works, and what'll bite you if you're not careful.
Search the database by what you're trying to do, not by which git command does it. Type undo last commit, rename branch, or get changes from someone else's branch — the matching commands are ranked by the strength of the keyword match.
Every command is annotated with a risk badge: safe (purely local or read-only), warning (changes local state in ways that need attention), or danger (rewrites history or can permanently lose work). Read the caveat before running anything flagged danger.
Every engineer ends up using a small subset of git's surface area 95% of the time: git status, git add, git commit, git push, and git pull. The other 200 commands exist for the moments when something's gone slightly wrong — which is exactly when you don't want to be Googling.
The riskiest commands to memorize wrong are the ones that rewrite history: git reset --hard, git push --force, git rebase -i, and git filter-branch. Each one can destroy work that hasn't been pushed yet. The reflog (git reflog) is your safety net for almost everything — it remembers your local HEAD movements for ~90 days. If you've nuked something locally, check the reflog before despairing.
git reset --soft HEAD~1 to undo the commit but keep the changes staged. Use git reset --mixed HEAD~1 (the default) to undo the commit and unstage the changes. Use git reset --hard HEAD~1 to undo the commit AND discard the changes (destructive). If the commit has already been pushed, prefer git revert HEAD to create a new commit that reverses it without rewriting history.git branch -m new-name. If you're on a different branch, use git branch -m old-name new-name. To rename the remote branch, push the new name and delete the old one: git push origin -u new-name && git push origin --delete old-name.git branch -d branch-name (safe, fails if unmerged) or git branch -D branch-name (force). Delete the remote branch with git push origin --delete branch-name. Always check with your team before deleting shared branches.git status for a summary of staged, unstaged, and untracked changes. Use git diff for unstaged changes, git diff --staged for staged changes, and git diff branch1..branch2 to compare branches. For just file names, add --name-only.git checkout -b new-branch. Your uncommitted changes will move with you. Then add and commit normally on the new branch.git reflog to find the commit hash, then git reset --hard <hash>. However, uncommitted changes that were not staged are typically lost. The rule: never run git reset --hard without verifying you have no uncommitted work, and consider git stash instead.