Back to the collection
resolving-merge-conflicts·Development

resolving-merge-conflicts guide: resolve Git conflicts by preserving intent

On this page

Resolve an in-progress merge or rebase using the intent recorded in commits, pull requests and requirements, then run checks and finish the operation.

Install and prepare

Run the following in your project terminal, then use the prompt below in Claude Code. This installs editable, project-scoped skill files.

Command
npx skills@latest add mattpocock/skills --skill resolving-merge-conflicts --agent claude-code

For Codex, replace claude-code with codex in the command and /resolving-merge-conflicts with $resolving-merge-conflicts in the prompt. With the complete Claude Code plugin, select /mattpocock-skills:resolving-merge-conflicts instead; avoid installing the same skills twice.

Use it in a repository already in a conflicted merge or rebase. Know the current branch, target and changes to preserve. Its workflow finishes the operation, including staging, committing or continuing a rebase, so define the intended scope at the start.

Your first task

Adapt the scenario and paths to your project, then enter this in the agent conversation:

Prompt
/resolving-merge-conflicts
The current conflict occurred while merging main. My branch adds export columns; main changes authorization. Preserve both intentions, read the relevant commits and run the project checks after resolving the conflict.

Work through the task

Understand the current operation

Inspect Git status and conflicting files to distinguish a merge from a rebase. Read commit messages and linked requirements. Selecting ours or theirs wholesale could retain new export columns while losing the authorization change, or preserve authorization while dropping the feature.

Resolve each hunk by intent

For each hunk, identify what each side intended and combine compatible behavior. If the rules cannot coexist, return to the merge goal and choose the intended semantics explicitly. Conflict resolution should not become an opportunity to invent an unrelated third behavior.

Check and finish

Run the repository’s type, test and formatting checks. In the export example, verify authorized and unauthorized access plus the new column data. A rebase can stop again at a later commit; repeat the process until the operation actually finishes.

Check the result

Confirm there are no unmerged files and no unfinished rebase. Inspect the final diff and relevant checks to establish that both requirements survived; removing conflict markers alone is insufficient.

Common questions

Can it decide whether to abandon a merge? Its default goal is to complete conflict resolution; abandoning or restarting the operation is a separate decision.

Do passing checks prove correctness? They cover existing assertions, so still compare the result with both requirements.

Does it push? The described workflow finishes the local operation; specify remote publication separately.

Test both intents in a configuration conflict

Suppose your branch adds a notification preference while main changes the default to off. Ask: “The rebase is stopped on notification configuration. Read both commits and linked requirements first. Keep the new user preference while respecting main's off-by-default rule; invent no third policy. Run existing notification checks after resolving each conflict and continue until the rebase ends.” Check Git status to establish the operation and remaining commits.

The absence of conflict markers is not enough. New users default to off, existing choices remain intact, and toggling the preference affects delivery as intended. If the intents truly cannot coexist, ask which one was dropped and why. A green test for the current file is not completion while Git still reports an in-progress rebase.

When rebase waits for an editor

After clearing conflict markers, running relevant checks, and reviewing the commit message, continue the rebase. A user of this skill found that git rebase --continue opened an interactive editor and left the agent waiting for input. If the command does not return, check whether an editor is waiting. When a noninteractive continuation is appropriate, set GIT_EDITOR for that command after confirming the message, then inspect git status, the resulting history, and tests. A still-running command is not a resolved conflict.

How did your first task go?

These choices help us understand where readers get stuck through site analytics. Blocking analytics may prevent delivery; use email for a specific issue.

References

  1. resolving-merge-conflicts — SKILL.mdmattpocock
  2. mattpocock/skills — READMEmattpocock
  3. resolving-merge-conflicts official usage guideMatt Pocock
  4. resolving-merge-conflicts blocks on git rebase --continueRianico
Found outdated or incorrect information? Let us know