Resolve git merge or rebase conflicts by comparing each side against the common ancestor, preserving both intents, and listing the checks to run before you commit.
You are helping resolve git conflicts. Work out what each side intended relative to the common ancestor, produce a resolution that keeps every intended change that still applies, and say exactly what to check before committing. ## Inputs Operation in progress (merge, rebase, cherry-pick) and the branch names: [OPERATION] Conflicted hunks, ideally with the base section shown (git config merge.conflictStyle zdiff3 or diff3, then redo the merge): [CONFLICT_HUNKS] What the current branch changed and why: [CURRENT_INTENT] What the incoming branch changed and why: [INCOMING_INTENT] Surrounding code, call sites or schema touched by either side: [SURROUNDING_CODE] Tests or commands that exercise this code: [TESTS] ## Instructions 1. Identify which side is which. During a rebase, "ours" is the branch being rebased onto and "theirs" is your work being replayed, so do not assume HEAD is your feature. 2. For each hunk, compare both sides with the base and classify the conflict: independent edits to adjacent lines, overlapping changes to the same logic, a delete versus a modify, a rename or move, or formatting only. 3. Write the resolved text for each hunk. Combine both intents when they are compatible. When they are not, pick one, explain why, and say what the other side loses. 4. Look beyond the markers for semantic conflicts: a renamed function or a changed signature that the other side's new code still calls, or a duplicated import or migration. 5. Never leave conflict markers in the output, and do not reformat lines that neither side changed. 6. Flag anything that needs a human decision, such as business rules, numeric behavior or data migrations. ## Return 1. Side mapping: which label belongs to which branch 2. A per-hunk table: location | base | current change | incoming change | conflict type | resolution 3. The resolved code for each hunk in code blocks 4. Semantic risks outside the markers 5. Commands to finish: edit the files, run the tests, run git diff --check to catch leftover markers or whitespace errors, git add the files, then continue the operation (git commit, git rebase --continue or git cherry-pick --continue) 6. Items needing manual review ## Acceptance checks - The resolution contains no <<<<<<<, =======, |||||||, or >>>>>>> lines. - Each side's stated intent is either present or explicitly dropped with a reason. - Call sites affected by a signature change are listed. - The tests to run are named; the response does not claim they passed.
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
Operation: git merge feature-discount into main.
Conflict (zdiff3):
<<<<<<< HEAD
TAX_RATE = 1.0825
def final_price(subtotal):
return round(subtotal * TAX_RATE, 2)
||||||| base
def final_price(subtotal):
return round(subtotal * 1.08, 2)
=======
def final_price(subtotal, discount=0.0):
return round((subtotal - discount) * 1.08, 2)
>>>>>>> feature-discount
Current intent: update the tax rate to 8.25% and name it. Incoming intent: support an optional pre-tax discount.
Tests: final_price(100) == 108.25; final_price(100, 10) applies the discount before tax.This conflict was reproduced and resolved in a local throwaway repository; any model wording is illustrative. The resolution keeps both changes:
TAX_RATE = 1.0825
def final_price(subtotal, discount=0.0):
return round((subtotal - discount) * TAX_RATE, 2)
The local run confirmed that no conflict markers remained, that final_price(100) == 108.25 and final_price(100, 10) == 97.42 passed, that git diff --cached --check was clean, and that the merge commit succeeded. A good answer also flags for manual review that (100 - 10) * 1.0825 = 97.425 rounds to 97.42 with Python's float round(), but to 97.43 with Decimal half-up rounding. It also notes that existing callers are unaffected because discount has a default.Ask questions or share concrete improvements.
No comments yet.
Sign in to join the discussion.
Guides for adapting and checking prompts:
Author-supplied tool and model tags; confirm behavior with your own examples.
IDEs
Models