Reference

Cheat Sheet

The commands you keep forgetting, with a one-line description and a real example you can copy - 384 across 26 tools. Pick a tool in the sidebar, or search across all of them.

Git

Everyday version control - stage, commit, branch, sync, and undo.
CommandWhat it doesExample
git initStart a new repository in the current folder.git init
git cloneCopy a remote repository to your machine.git clone https://github.com/torvalds/linux.git
git statusShow what is staged, changed, and untracked.git status
git addStage changes for the next commit.git add src/app.js
git commitSave the staged changes with a message.git commit -m "Add login form"
git commit -amStage all tracked files and commit in one step.git commit -am "Fix header spacing"
git logShow commit history, compact and graphed.git log --oneline --graph --all
git diffShow line-by-line unstaged changes.git diff src/app.js
git branchList branches, or create a new one.git branch feature-search
git switchMove to another branch.git switch main
git switch -cCreate a branch and switch to it.git switch -c feature-search
git mergeMerge another branch into the current one.git merge feature-search
git rebaseReplay your commits on top of another branch.git rebase main
git pullFetch and integrate changes from the remote.git pull origin main
git pushSend your commits to the remote.git push origin main
git stashShelve uncommitted changes to come back to.git stash
git stash popReapply the most recently stashed changes.git stash pop
git reset --softUndo the last commit, keep changes staged.git reset --soft HEAD~1
git restoreDiscard changes to a file in the working tree.git restore src/app.js
git revertMake a new commit that undoes an old one.git revert 1a2b3c4
git remote -vList the remotes and their URLs.git remote -v
git tagMark a commit with a version tag.git tag -a v1.2.0 -m "Release 1.2.0"