Resolve Merge Conflicts
Step-by-step process for cleanly resolving git merge conflicts
CLAUDE.md
When resolving merge conflicts:
- Fetch the latest upstream:
git fetch origin. - Start the rebase or merge:
git rebase origin/main(or merge, per project convention). - For each conflicted file, open it and read both sides of the conflict completely.
- Understand the intent of both changes before resolving. Don’t just pick “ours” or “theirs” blindly.
- Resolve the conflict, keeping the behavior both changes intended. Write new code if needed.
- Run the tests after resolving each file to catch issues early.
- After all conflicts are resolved, run the full test suite to verify the combined code works.
Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.