Merge conflicts
Untangles merge, rebase and cherry-pick conflicts one file at a time, explains each choice, and proves nothing was lost.
Claude Code skill codemaman-merge-conflicts, works with Git, GitHub and Jira.
Nothing lost in the swell
Install it
Copies the skill into ~/.claude/skills:
curl -fsSL https://toolsfortechies.dev/install.sh | bash -s -- codemaman-merge-conflictsOr download the zip and unzip it into ~/.claude/skills. Restart Claude Code afterwards.
Try it
- Ask Claude
- “Fix my merge conflicts with main”
- Or run
/codemaman-merge-conflicts
Before you start
- You'll need
- git. Jira access and the gh CLI are optional, for context on intent.
- What it won't do without you
- Records the starting SHA and how to abort. Never force-pushes, resets or takes a whole side blindly.
Read the SKILL.md
# Merge conflict resolver Understand what each side was trying to do before choosing a resolution. Never resolve a conflict by blindly taking one side, and never discard work without saying so. ## 1. Orient (read-only) - Work out which operation is in progress: merge (`.git/MERGE_HEAD`), rebase (`.git/rebase-merge` or `rebase-apply`), cherry-pick (`CHERRY_PICK_HEAD`), revert, or stash pop. State it in one line, along with the two sides: "ours" and "theirs" mean opposite things in a rebase, so say plainly which branch each one is. - `git status` to list conflicted files (`both modified`, `deleted by us/them`, `added by both`) and anything already staged. - Record a safety point first: the current branch and its tip SHA, and the exact way back (`git merge --abort`, `git rebase --abort`, or `git reflog`). If the working tree has unrelated uncommitted changes, stop and ask before continuing. - Find the ticket from the branch name (for example ABC-123) and, if a Jira tool is connected, read it for intent. Read the PR description if there is one. ## 2. Understand both sides For each conflicted file: - `git diff --merge <file>` or `git diff --name-only --diff-filter=U`, and the three versions: `git show :1:<file>` (base), `:2:` (ours), `:3:` (theirs). - `git log --merge -p -- <file>` or `git log <base>..<side> -- <file>` to see why each side changed it. - Classify the conflict: - **Both sides made independent changes**: keep both. - **Same change made twice** (cherry-picks, backports): keep one copy. - **Conflicting intent**: one side renamed or moved code the other edited, or two different behaviours. This needs a decision, so ask the user with both options and what each would change. - **Generated or lock files** (`package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`, snapshots, `*.min.js`, migrations ordering): do not hand-edit. Take the target branch's version, then regenerate with the project's own command (for example `npm install`), and say so. - **Delete versus modify**: say which side deleted it and why, and ask unless it's obvious from the commit history. ## 3. Resolve one file at a time - Edit the file to the correct combined result, removing every `<<<<<<<`, `=======` and `>>>>>>>` marker. Check the result still makes sense as code, including imports, function signatures and tests that touch both changes. - Keep the resolution minimal. Don't reformat or tidy unrelated lines. - For a decision that isn't clear-cut, show the user a short before/after and the options, then wait. - `git add <file>` only when that file is finished. ## 4. Verify before continuing - `git diff --check` and `grep -rn '^<<<<<<<\|^>>>>>>>' .` (skipping vendored directories) find leftover markers. - Run the project's type check, lint and the tests for the touched areas. Fix failures caused by the merge. Report any that already failed before the merge rather than fixing them silently. - Prove nothing was dropped: compare each side's intent against the result, for example `git diff <their-branch> -- <file>` and `git diff <our-branch> -- <file>` should only show the other side's intended differences. ## 5. Finish the operation - Merge: `git commit` (keep the default merge message, adding a line for notable decisions). - Rebase: `git rebase --continue`, and repeat from step 2 for each following commit that conflicts. - Cherry-pick: `git cherry-pick --continue`. Stash pop: the stash is kept if it conflicts, so drop it only after the result is checked (`git stash drop`). - Do not push. If the branch was already pushed and a rebase rewrote it, tell the user a force push is needed and offer `git push --force-with-lease` for them to confirm. Never use plain `--force`. ## 6. Report Give a short summary: which operation, which files conflicted, how each was resolved and why (one line each), anything the user decided, what was verified, and how to undo it (the original tip SHA and `git reflog`). Flag anything you were unsure about. ## Rules - If it's going badly, abort cleanly (`git merge --abort` or `git rebase --abort`) and explain, rather than pushing on with guesses. - Never `git checkout --ours/--theirs .` across the whole tree, `git reset --hard`, `git clean`, or delete conflicted files to "make it go away". - Don't change unrelated files or commit anything beyond the resolution. - Prefer preventing repeats: if the same area conflicts often, suggest merging the target branch in regularly, or enabling `git config rerere.enabled true`, and ask before changing config.Open the raw file