Resolve a Git Merge Conflict and Keep What Both Branches Intended
Paste your conflict markers and get a plain explanation of each side's change, a merged version that keeps both intents, and a test checklist.
You getSide A, side B and merged code
Prompt
Act as a senior software engineer who reviews merge conflicts for a team.
I will paste one or more git conflict blocks right after this message. They will include the lines between the conflict markers and, when I can, a few lines of surrounding code and the two branch names. Resolve the conflict.
Rules:
1. Before proposing anything, describe what each side changed in plain words and quote the exact lines that differ.
2. State the likely intent behind each change with a confidence level (high, medium, low). Do not guess silently.
3. The merged version must keep both intents unless they truly contradict. If they do, say which one you kept and why.
4. Return complete code with no conflict markers left, in the original language, indentation and naming style.
5. If the snippet is too short to judge (missing imports, callers or tests), name the exact lines or files you need instead of guessing.
Output format:
1. Side A (ours / HEAD): what changed, likely intent, confidence
2. Side B (theirs / incoming): what changed, likely intent, confidence
3. Merged code: one code block
4. Why this merge: 2-4 bullets
5. Test before committing: numbered checklist of specific cases, commands or files to check
End with one line naming any assumption you made or the main risk this merge carries.Example output
Tips and common edits
Why this works
- Explaining each side before merging forces the model to understand intent instead of just picking one block of lines.
- Confidence levels and the rule to ask for missing lines reduce confident but wrong merges on partial snippets.
- A concrete test checklist with commands catches leftover markers and behavior clashes before the commit lands.
Use when git stops a merge or rebase with conflicts. Copy the full conflict block plus a few surrounding lines and the branch names, then paste it into ChatGPT, Claude or Gemini after the prompt.
Common edits
- Paste several conflict blocks at once and ask for one section per file.
- Add your team's rule, such as 'prefer main when in doubt', to rule 3.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Review a Beginner's Code with Kind, Prioritized Feedback on the Top 3 Fixes
Paste your code and get a mentor-style review with one specific compliment, the three highest-impact fixes ranked with corrected snippets, and one next step.
Refactor Pasted Code for Readability Without Changing Its Behavior
Returns a cleaner version of your code plus a change log that explains each edit, why behavior is preserved, and which edge cases you should test.
Write Conventional Commit Messages from a Pasted Git Diff
Paste a Git diff and get conventional commit messages with 50-character subjects and bodies that explain why, plus a split plan when the changes are unrelated.
Explain Any Regex Token by Token with Matching and Failing Examples
Get a token-by-token table explaining your regex, plus strings that match, nearly match and fail, and a clear catastrophic backtracking risk check with a safer rewrite.
Explain a Complex SQL Query in Plain English, Step by Step
Get a plain-English walkthrough of any SQL query in execution order, with tiny sample tables, row counts after each clause, and the hidden gotchas.
Explain Pasted Code Line by Line with a Worked Example for Beginners
Get a block-by-block walkthrough of any code you paste, with one example input traced through every step and three questions to check that you understood it.