Git Cheatsheet

A categorized quick reference for everyday Git commands. Covers setup, branching, staging, committing, remote operations, commit history, and undo/recovery - each with a clear description and working example. Search to find commands instantly.

FAQ

The cheatsheet covers six categories: Setup & Init (git config, init, clone), Branching (branch, checkout, switch, merge, rebase), Staging & Committing (add, commit, stash, reset), Remote (remote, push, pull, fetch), History & Log (log, diff, show, blame), and Undo & Fix (revert, restore, clean, reflog).

The cheatsheet focuses on commands you'll use daily as a developer, from beginner (git add, commit, push) to intermediate (rebase, stash, reflog). It's designed to be useful for both learning Git and as a quick reference for experienced developers.

git fetch downloads changes from the remote without merging them — it updates your remote-tracking branches (origin/main) but leaves your working branch untouched. git pull does both fetch AND merge in one step. Use fetch when you want to inspect changes before merging; use pull for quick syncs when you're sure.

git stash temporarily shelves uncommitted changes, reverting your working directory to the last commit. git stash pop reapplies the most recent stash and removes it from the stash list. git stash apply reapplies without removing. Useful for switching branches mid-work without committing unfinished code.

git bisect uses binary search to find the commit that introduced a bug. Mark a known-good commit and a known-bad commit, and git automatically checks out the midpoint. Test and mark good/bad — in roughly log2(N) steps you'll identify the exact commit that broke things. A powerful debugging tool for regression hunting.

Yes. Use the search box to filter commands by name, description, or example. For instance, searching "rebase" finds both the rebase command and any descriptions mentioning rebasing. Categories with no matching results are hidden automatically.