Git
The commands you reach for every day.
Basics
git init- Create a repository
git clone <url>- Clone a repository
git status- Show working tree status
git add -p- Stage hunks interactively
git commit -m "msg"- Commit staged changes
Branching
git switch -c feat- Create & switch branch
git switch main- Switch branch
git merge feat- Merge into current
git rebase main- Replay onto main
git branch -d feat- Delete a branch
Remotes & history
git pull --rebase- Update, replaying local
git push -u origin feat- Push & set upstream
git log --oneline --graph- Compact history
git restore --staged f- Unstage a file
git reset --hard origin/main- Match remote (destructive)