Back to Cheat SheetsTooling · Beginner

Git cheat sheet

Everyday commands plus the recovery ones you need under pressure.

Daily flow

Branch

git switch -c feature/checkout-tests

Stage and commit

git add -p && git commit -m "add checkout specs"

Sync

git pull --rebase origin main

Push

git push -u origin HEAD

Inspect

Status / log

git status -sb; git log --oneline --graph -10

Diff staged

git diff --staged

Who changed it

git blame path/to/file

Recovery

Undo last commit, keep changes

git reset --soft HEAD~1

Discard local changes

Irreversible

git restore .

Stash

git stash push -m wip && git stash pop

Find lost commit

git reflog

Go beyond the reference

Book a free demo class and apply these commands on live project work.