Commencer
Git Surgery — recover & rewrite history safely

Git Surgery — recover & rewrite history safely

Built around one rule learned the hard way: never make a git mess worse. Before anything risky it snapshots a backup ref, then guides you through the real recovery toolkit — reflog rescue for "lost" commits, interactive rebase, cherry-pick, safe revert vs hard reset, fixing "committed to the wrong branch," and bisect to find where a bug crept in — flagging at each step which moves are reversible and which are destructive. Safety-first git surgery for when things go sideways.
#Ingénierie
Note
Davantage d’évaluations nécessaires
Vendus
0
Mode d’utilisation
Télécharger

Git Surgery 🔧

Get out of any git mess — without making it worse.

You force-pushed over a teammate's work. You reset --hard'd and lost an
afternoon. You committed to main instead of your feature branch. Git Surgery is
the calm expert who walks you out of it — recovering what's lost and reshaping
history safely, always telling you which moves are reversible and which aren't.

What it does

  • Recover lost work — "lost" commits, deleted branches, blown-away changes (reflog, fsck).
  • Rewrite history safely — interactive rebase, squash, reorder, amend.
  • Undo mistakes — bad commit, wrong branch, accidental merge, force-push gone wrong.
  • Find the breakage — git bisect to pinpoint the commit that introduced a bug.
  • Backup-first — snapshots a recovery ref before anything destructive, so there's always an undo for the undo.

Example

You: "I ran git reset --hard and my last 3 commits are gone."
Git Surgery: Don't panic — they're almost certainly recoverable. git reflog
points to the SHA right before the reset; git branch rescue <sha> restores all
three. I'll snapshot a backup ref first, then walk it step by step.

You: "I committed to main, should've been a feature branch."
Git Surgery: Fully reversible — git branch feature saves the work, then
git reset --hard origin/main moves main back. Your commits now live on feature.

When to reach for it

  • "I lost my commits / my work is gone"
  • "Undo this commit / I committed to the wrong branch"
  • "Clean up these messy commits before the PR"
  • "Where did this bug come from?"
  • Any time you're about to type --force and aren't 100% sure

Why it's different

Most git advice online is a copy-paste command with no safety net. Git Surgery
explains the move, flags the danger, and makes a backup ref first — so you
learn git's mental model instead of just surviving the moment.

FAQ

Will it run destructive commands for me? No — it gives you the exact commands and confirms the risky ones; you
stay in control.
What if my work is really gone? reflog keeps HEAD moves ~90 days; most "lost" work comes back. It checks there
first, every time.
Does it work with my setup? It's plain git — any repo, any host (GitHub/GitLab/Bitbucket/self-hosted).