Skip to content

commandGit and releases

Resolve Conflicts

Finds every conflicted file after a merge or rebase, resolves each with written reasoning and runs the checks before you continue.

npx workspacetemplates add resolve-conflicts --tool claude-code

Writes 1 file to .claude/commands/

.claude/commands/resolve-conflicts.md15 lines · 1.2 KBFile
---
description: Finds every conflicted file after a merge or rebase, resolves each with written reasoning and runs the checks before you continue.
argument-hint: "[hints on which side should win, optional]"
---

Resolve the merge or rebase conflicts in this repository. Notes: $ARGUMENTS

1. Run `git status` to see whether a merge, rebase or cherry-pick is in progress, and `git diff --name-only --diff-filter=U` for the conflicted files.
2. For each file, view the three versions (`git show :1:file`, `:2:`, `:3:`) and the commit messages on each side (`git log --merge -p -n 3 -- file`). Decide what each side intended.
3. Resolve by combining intents, not by picking a side. For lockfiles, regenerate with the package manager instead of editing markers. For generated files, rerun the generator.
4. Remove every marker and check with `grep -rn "<<<<<<<\|>>>>>>>" .` that none remain.
5. If a conflict changes behavior and you cannot tell which intent wins, leave the file unresolved and ask.
6. Run lint, type check and tests.

Print a table of file, resolution and reason. Then `git add` only the files you resolved, and ask before `git rebase --continue` or `git commit`. Never run `--abort` or `checkout --theirs` without asking.

What it does

A conflict marker is easy to delete and hard to resolve correctly. This command reads both sides, the base version and the commit messages behind them so that the result keeps the intent of each change.

Each file gets a short reason for the chosen resolution. Lines where the intent is unclear are left for you, and the project tests must pass before the merge or rebase is continued.

Example

you › /resolve-conflicts keep the new API names from main

agent › Rebase stopped on 4 files.
package-lock.json: regenerated with npm install.
src/api/orders.ts: combined main's renamed fetchOrder with your pagination argument.
src/ui/Cart.tsx: unclear, both sides rewrote the discount rule. Left for you.
3 of 4 resolved, tests pass. Continue the rebase?

Questions

Does it always pick my side or theirs?
No. It works out the goal of each change and keeps both when it can, and asks when the two goals contradict.
Can it finish the rebase for me?
Only after you confirm. It stages the files it resolved and waits for your go-ahead to continue.
  • Branch Cleanup

    CommandGit and releases

    Free
  • Changelog Entry

    CommandGit and releases

    Free
  • Cherry Pick Fix

    CommandGit and releases

    Free
  • Commit Message

    CommandGit and releases

    Free