Git, explained like a human
Plain-English fixes for the git moments that make you sweat — undoing commits, surviving force pushes, cleaning up history. Real commands, honest trade-offs, no man-page speak.
Undo and recover
-
How to recover a deleted branch
Deleted a branch — locally, on GitHub, or both — and need it back? The commits almost certainly still exist. Here's where they went and how to get them back.
-
How to recover from a force push
Force-pushed and wiped commits off GitHub? They're very likely still recoverable — if you move before GitHub's garbage collector does. Here's how.
-
How to undo a git commit (without making it worse)
Every way to undo a git commit — keep the changes, drop the changes, or undo a commit you already pushed — and how to pick the right one.
-
How to undo a git merge
Merged the wrong branch, or merged way too early? How to undo a git merge — whether it's still local, already pushed, or still sitting there conflicted.
-
How to undo a git rebase
Rebased onto the wrong base, mangled an interactive rebase, or pushed a rebase you regret? The reflog remembers where your branch was — here's how to go back.
-
How to undo git reset --hard
Just watched git reset --hard eat your work? Committed work is almost always recoverable through the reflog. Uncommitted work is grimmer — here's the honest version of both.
Clean up history
-
How to remove a commit from a pull request
Committed something that shouldn't be in the PR — a debug file, a wrong change, a commit meant for another branch? Two ways to get it out, and when each is right.
-
How to remove a file from git history
A .env full of secrets, a 300MB binary, a build artifact that never should've been committed — how to purge a file from every commit with git filter-repo.
-
How to remove a secret from git history
Committed a password, API key, or token to git? Rotate it first, then scrub the history with git filter-repo — including the GitHub support step almost every guide skips.
-
How to squash commits (and when not to)
Turn 'wip', 'fix', and 'actually fix this time' into one clean commit — with interactive rebase, GitHub's squash merge, or a pull request that does it for you.
Move work between branches
-
How to backport a pull request to another branch
The fix landed on main, but your release branch needs it too. How to cherry-pick a PR onto another branch — and how to see the conflicts coming before you're in them.
-
Pushed to the wrong branch? Here's how to fix it
Committed work onto main that belonged on a feature branch — and maybe pushed it too. Move it with cherry-pick, then clean up the wrong branch the safe way.
Safety nets
-
How to back up a branch before doing something risky
About to rebase, reset, or let an AI agent loose on your repo? Spend thirty seconds on an undo point first. Future you says thanks.
Understand git
-
Git commands explained in plain English
What reset, revert, rebase, cherry-pick, reflog and friends actually do — explained like a coworker would, not like a man page.