Every command, one search away.
Setup
git initStart tracking a new folder
git config --global user.name "Name"Set your commit identity
git config --global user.email "you@example.com"Set your commit email
Basics
git add <file>Stage a change
git commit -m "message"Save a permanent snapshot
git statusSee what's changed and staged
git logView commit history
Branching
git branch <name>Create a branch
git checkout <name>Switch to a branch
git merge <name>Combine a branch into the current one
git stashSave unfinished work temporarily
git stash popRestore the most recent stash
Remote
git clone <url>Copy a remote repository locally
git fetch originDownload remote changes without merging
git rebase origin/masterReplay local commits on updated history
git merge <name> --no-ff -m "msg"Force a merge commit with a custom message
Tags & Advanced
git tag <name>Mark a commit as a release point
git push origin <tag>Push a tag to the remote
git cherry-pick <a>^..<b>Copy a range of commits onto the current branch
History
git show <commit>View one commit in full detail
git log --author="name"Filter history by author
git log --since="date" --until="date"Filter history by date range
git log -5 --onelineShow the last five commits, compactly
git revert <commit>Safely undo a commit
git reset --hard <commit>Rewrite history; use with caution