Git
Git from the object store up: what add and commit write, how merges decide, how to undo and recover, release and CI workflows, big-repo tools and a leaked-secret playbook, with live labs and 13 runnable incidents.
Overview
How to use this sheet
Every table below lists a command, what it does, and how risky it is. The risk column uses these four labels, so you can scan for danger before you press Enter.
- Safe — Changes nothing, or only adds new objects and refs
- Rewrites history — Moves the branch to different commits: new ones with new IDs, or an older one. Fine on local work; others must recover if they already pulled it
- Loses uncommitted work — Overwrites files or the index. Nothing recorded those edits, so no command brings them back
- Deletes files — Removes untracked files from disk. Git never stored them
The reflog can undo almost anything that was once committed. It cannot undo the last two rows. When a command is marked with them, commit or stash first.
The page follows a change from your keyboard to production: how Git stores it, how branches combine, how to undo and recover, how it travels to a remote, how releases, CI and bots handle it, and what to do when it goes wrong. Thirteen runnable incidents close the page.
- Object trace — the real blob, tree and commit ids that add and commit write
- Three trees, commit graph, remotes, bisect — interactive Git models you drive with commands
- Merge trace — how a three-way merge decides each region, ported from Git's own merge code
- Rebase ids, reflog, bisect traces — why ids change, how reset --hard is undone, how bisect picks commits
- Six workflows — PR to production, hotfix backport, semantic-release, hooks and bots, monorepo CI, leaked secret
Sign up free to read the full topic
More Quick References topics
Start free on Cariara · Coding problems · System design studio