⌨️ Codingintermediategitmerge-conflictversion-controlcollaboration

Resolve a Git Merge Conflict

Understand and correctly resolve a git merge conflict by understanding both branches' intent.

The Prompt

prompt.txt
Help me resolve the following git merge conflict. For each conflicted section:
1. Explain what each side was trying to do (HEAD vs incoming)
2. Determine the correct resolution (keep HEAD, keep incoming, or merge both)
3. Show the resolved code
4. Explain your reasoning

Context about the conflict:
[DESCRIBE WHAT BOTH BRANCHES WERE WORKING ON — e.g., My branch added email validation to the user creation function. The incoming branch refactored the function to use a new User class.]

Conflicted code:
```
[PASTE THE CONFLICTED FILE WITH <<<<<<, =======, >>>>>>> MARKERS]
```

Example Output

Resolved by merging both changes: kept the new User class structure from the incoming branch but integrated the email validation logic from HEAD's branch, adding the validation as a method on the User class rather than inline in the handler.

FAQ

Which AI model is best for Resolve a Git Merge Conflict?

Claude Sonnet 4 — good at reasoning about intent from both sides of a conflict.

How do I use the Resolve a Git Merge Conflict prompt?

Copy the prompt, replace the [BRACKETED] placeholders with your specific information, and paste into your preferred AI assistant (ChatGPT, Claude, Gemini, etc.). Resolved by merging both changes: kept the new User class structure from the incoming branch but integrated the email validation logic from HEAD's branch, adding the validation as a method on the User class rather than inline in the handler.