Git
Git — the 18 commands that get you through 99% of git use
## Status `git status` — what's changed `git log --oneline -20` — last 20 commits one-line `git diff` / `git diff --staged` — unstaged / staged changes ## Stage + commit `git add file` / `git add -p` — stage file / stage interactively `git commit -m "msg"` — commit staged `git commit --amend` — fix last commit (before pushing!) ## Branches `git switch -c new-branch` — create + switch `git switch main` — switch `git branch -d branch` — delete merged branch `git push -u origin branch` — first push of a branch ## Sync `git pull --rebase` — pull and replay your commits on top `git push` — push current branch `git fetch` — download remote refs without merging ## Undo `git restore file` — discard unstaged changes to file `git restore --staged file` — unstage file `git reset --hard origin/main` — nuke local, match remote (destructive)