| name | git-conflict-resolution |
| description | Guidelines for resolving git merge and rebase conflicts efficiently. Claude should use this skill when resolving merge conflicts or rebase conflicts to prefer bulk git strategies over manual conflict marker editing. |
Git Conflict Resolution
When resolving merge or rebase conflicts, prefer efficient git strategies over manually editing conflict markers.
Bulk Resolution with git checkout
When all conflicts in a file should be resolved the same way, use git checkout instead of editing conflict markers one at a time:
git checkout --theirs <file>
git checkout --ours <file>
After resolving, stage the file:
git add <file>
Multiple files can be resolved in one command:
git checkout --theirs file1.md file2.md
git add file1.md file2.md
When to Use Each Strategy
| Strategy | When to Use |
|---|
--theirs | The remote version has the completed/updated work (e.g., plan files with tasks checked off) |
--ours | Your local version is the one to keep (e.g., you made intentional local changes) |
| Manual edit | Conflicts require combining parts of both versions |
Decision Process
Before editing conflict markers manually, ask:
- Can I accept one side entirely? If yes, use
git checkout --theirs or --ours.
- Are multiple files conflicted the same way? Resolve them all in one command.
- Do I need parts of both sides? Only then edit manually.
Post-Resolution Verification
After resolving all conflicts:
- Verify no conflict markers remain: search for
<<<<<<<, =======, >>>>>>>
- Run
git status to confirm no unmerged paths remain
- Run tests if source code was involved