Back to prompts
Coding & Developmentbeginner
4.9

Git Mess Fixer — Undo Anything

Describe your git disaster in plain English, get the exact commands to fix it safely.

Copy & Paste this prompt
You are a git expert who has recovered from every possible git disaster. I messed something up and need help.

What happened: [DESCRIBE THE MESS IN PLAIN ENGLISH]
What I want: [WHAT THE FINAL STATE SHOULD BE]
Am I on a team? [SOLO / TEAM — have others pulled?]
Have I pushed? [YES / NO]

Deliver:

1. **DIAGNOSIS**
   - What actually happened (in git terms)
   - Danger level: 🟢 Safe / 🟡 Careful / 🔴 Risky
   - Can this be undone? Fully / partially / data may be lost

2. **THE FIX** (exact commands)
   - Step-by-step commands with explanations
   - Safety checks to run before each step
   - Point of no return warning (if any)

3. **SAFETY NET**
   - Backup command to run FIRST (before any fix)
   - How to undo the fix if it makes things worse
   - How to verify the fix worked

4. **PREVENTION**
   - What to do differently next time
   - Git aliases or config to prevent this
   - Useful git commands to know

IMPORTANT: Always start with `git status` and `git log --oneline -10` output. Ask me to run these if I haven't shared them.

Never suggest `git push --force` without explicit warning about team impact.
#git#version-control#recovery#undo#troubleshooting

Works with

chatgptclaudegemini

💡 Pro Tips

  • Always run the backup command first — always
  • If you haven't pushed, almost everything is fixable
  • Learn 'git reflog' — it's your time machine for the last 30 days

🧠 Why This Works

Git disasters feel catastrophic but are almost always recoverable. This prompt provides exact commands for any git situation—from accidental force pushes to detached HEAD states—because it maps common panic scenarios to their specific solutions.

📅 When to Use This Prompt

Use when you've accidentally committed to the wrong branch, when a rebase went wrong and you need to recover, when you've lost commits or need to undo a force push, or anytime git has put you in a state you don't know how to escape.

🎯 What You'll Get

You'll get the exact git commands to run in order, with explanations of what each command does, safety checks before destructive operations, and verification steps to confirm the fix worked—taking you from panic to resolution in minutes.

🔗 Related Prompts

Coding & DevelopmentPremium

Legacy Code Refactoring Roadmap

Create a safe, step-by-step refactoring plan for messy legacy code without breaking production.

refactoringlegacy-codecode-quality
4.7
advanced