# Fix a Git problem

Step-by-step help for merge conflicts, undoing mistakes, branching, and recovering lost work.

- Topic: Software Development
- Framework: Chain-of-Thought
- Level: Standard
- Tags: Coding, Rewrite & Edit, Explain & Teach, Fill-in Template, Step-by-step
- Source: https://www.thinkwithprompt.com/prompts/fix-a-git-problem

## Prompt

```text
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.
```

## What to fill in

- PASTE
- YES / NO
- DETAILS

Free to copy and use. From ThinkWithPrompt (https://www.thinkwithprompt.com/), a library of 2,663 curated AI prompts.
