Fix a Git problem
Step-by-step help for merge conflicts, undoing mistakes, branching, and recovering lost work.
The prompt
Help me with a Git problem.
What I'm trying to do or what went wrong: [e.g. "undo my last commit", "merge conflict", "I committed to the wrong branch", "recover a deleted branch", "fork and contribute to a repo"]
Output of `git status` and `git log --oneline -10`: [PASTE]
Have I pushed the changes? [YES / NO]
Shared branch or just mine? [DETAILS]
Explain what's going on in plain language, then give the exact commands step by step, with what each does. Warn me before any command that rewrites history or can lose work (reset --hard, force push, rebase on shared branches), and give the safest option first. Finish with how to verify everything is fixed.
Highlighted [brackets] are blanks to replace with your own details.
Fill in the blanks and use this promptMore Software Development prompts
What to fill in
- PASTE
- YES / NO
- DETAILS
How this prompt is built
This prompt follows the Chain-of-Thought structure (Chain-of-thought prompting). A chain-of-thought prompt asks the model to work through a problem step by step before giving its answer, which tends to help on reasoning, planning and multi-part questions.
Related prompts
- Find which change caused a regressionCreates a systematic plan to pinpoint the commit, deploy, or config change that broke something that used to work.
- Get unstuck on a coding error with hints instead of the answerA plain-English explanation of your error and step-by-step hints, so you learn to debug instead of copying a fix.
- Build a working app, tool, or game from a descriptionTurns a plain-English idea into a complete, runnable app — web tool, dashboard, or browser game.
- Explain what a piece of code doesPlain-language walkthrough of unfamiliar code: purpose, flow, key parts, and gotchas.