Cheat sheet

Git everyday

Updated 2026-10-17 cheatsheets/git-everyday.md #git #cli

Git everyday

Status & history

git status
git log --oneline -20
git diff
git diff --staged

Branching

git switch -c feature/name
git switch main
git branch -d feature/name

Commit

git add path/to/file
git commit -m "message"
git push -u origin HEAD

Undo (safe)

git restore path/to/file
git restore --staged path/to/file
git reset --soft HEAD~1