Skip to content

Cheatsheets

Compact, scannable reference tables — pick a topic below.

Git Cheatsheet

The Git commands you reach for most often, grouped by what you're trying to do.

Start / connect

git initStart a new repo
git clone <url>Copy a remote repo locally
git remote -vShow configured remotes

Save work

git statusSee what's changed
git add <file>Stage changes
git commit -m "msg"Commit staged changes
git pushUpload commits
git pullDownload + merge remote commits

Branches

git branchList branches
git switch -c <name>Create + switch to a branch
git merge <branch>Merge a branch in
git rebase <branch>Replay commits on top of another branch

Undo

git restore <file>Discard unstaged changes to a file
git reset --soft HEAD~1Undo last commit, keep changes staged
git revert <commit>Undo a commit safely (new commit) Safe for already-pushed commits.
git stashShelve changes temporarily