$npx -y skills add warpdotdev/common-skills --skill resolve-merge-conflictsResolve Git merge conflicts by extracting only unresolved paths, conflict hunks, and compact diffs instead of loading whole files into context. Use when a merge, rebase, cherry-pick, or stash pop stops on conflicts, when git status shows unmerged paths, or when files contain co
| 1 | # Resolve Merge Conflicts |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Resolve conflicts without opening full files unless the compact view is insufficient. Start with a summary, then inspect one conflicted file at a time. |
| 6 | |
| 7 | ## Workflow |
| 8 | |
| 9 | 1. Start with a summary. |
| 10 | |
| 11 | ```bash |
| 12 | python3 .agents/skills/resolve-merge-conflicts/scripts/extract_conflict_context.py |
| 13 | ``` |
| 14 | |
| 15 | Use the summary to identify which files are unresolved, which index stages exist, and how many text hunks each file contains. |
| 16 | |
| 17 | 2. Drill into one file. |
| 18 | |
| 19 | ```bash |
| 20 | python3 .agents/skills/resolve-merge-conflicts/scripts/extract_conflict_context.py --file path/to/file |
| 21 | ``` |
| 22 | |
| 23 | Prefer this over reading the whole file. The script prints only nearby context, the `ours` / `base` / `theirs` sections for each hunk, and a compact unified diff between `ours` and `theirs`. |
| 24 | |
| 25 | 3. Resolve the file. |
| 26 | |
| 27 | - Take one side wholesale with `git checkout --ours -- path/to/file` or `git checkout --theirs -- path/to/file` when appropriate. |
| 28 | - Otherwise edit the file directly and remove the conflict markers. |
| 29 | - Read more of the file only if the compact output is not enough to decide the correct merge. |
| 30 | |
| 31 | 4. Re-check unresolved files. |
| 32 | |
| 33 | ```bash |
| 34 | python3 .agents/skills/resolve-merge-conflicts/scripts/extract_conflict_context.py |
| 35 | git diff --name-only --diff-filter=U |
| 36 | ``` |
| 37 | |
| 38 | 5. Validate the resolution. |
| 39 | |
| 40 | - Ensure no unmerged paths remain. |
| 41 | - Ensure no `<<<<<<<`, `=======`, or `>>>>>>>` markers remain in the resolved files. |
| 42 | - Run targeted tests, builds, or linters for the touched area. |
| 43 | - Stage the resolved files. |
| 44 | |
| 45 | ## Commands |
| 46 | |
| 47 | ### Summary only |
| 48 | |
| 49 | ```bash |
| 50 | python3 .agents/skills/resolve-merge-conflicts/scripts/extract_conflict_context.py |
| 51 | ``` |
| 52 | |
| 53 | ### Detailed view for one file |
| 54 | |
| 55 | ```bash |
| 56 | python3 .agents/skills/resolve-merge-conflicts/scripts/extract_conflict_context.py --file path/to/file |
| 57 | ``` |
| 58 | |
| 59 | ### Detailed view for all conflicted files |
| 60 | |
| 61 | ```bash |
| 62 | python3 .agents/skills/resolve-merge-conflicts/scripts/extract_conflict_context.py --all |
| 63 | ``` |
| 64 | |
| 65 | ### JSON output |
| 66 | |
| 67 | ```bash |
| 68 | python3 .agents/skills/resolve-merge-conflicts/scripts/extract_conflict_context.py --file path/to/file --json |
| 69 | ``` |
| 70 | |
| 71 | ### Tune output size |
| 72 | |
| 73 | ```bash |
| 74 | python3 .agents/skills/resolve-merge-conflicts/scripts/extract_conflict_context.py \ |
| 75 | --file path/to/file \ |
| 76 | --context 3 \ |
| 77 | --max-lines 60 |
| 78 | ``` |
| 79 | |
| 80 | ## Notes |
| 81 | |
| 82 | - Use the script before opening conflicted files directly. |
| 83 | - Resolve one file at a time to keep context small. |
| 84 | - Expect marker-based text conflicts and index-only conflicts such as add/add or modify/delete. The script summarizes both, and it falls back to index-stage previews when the worktree file has no conflict markers. |