Resolving Rollback Conflicts logo

Resolving Rollback Conflicts

OrganizationPopular
marmelab
resolving-rollback-conflicts

Replay a list of git-revert commits against the current base branch and resolve the conflicts, when the chat-service's automatic rollback hit a merge conflict it couldn't resolve. Load this when your developer dispatch asks you to resolve a rollback conflict (it carries BASE_BRANCH, FAILED_COMMIT, COMMITS_TO_REVERT). This is NOT a feature ticket — the workflow below replaces the normal ticket rules.

Overview

Publishermarmelab
Repositoryatomic-crm
Skill nameresolving-rollback-conflicts
Stars
1.4K
Forks
860
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by marmelab on GitHub. Read the source before you install it.

Installation

Install the Resolving Rollback Conflicts AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/marmelab/atomic-crm/tree/main/.claude/skills/resolving-rollback-conflicts
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/marmelab/atomic-crm.git /tmp/atomic-crm
mkdir -p .claude/skills
cp -r /tmp/atomic-crm/.claude/skills/resolving-rollback-conflicts .claude/skills/resolving-rollback-conflicts
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Resolving Rollback Conflicts in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Resolving Rollback Conflicts on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Resolving Rollback Conflicts is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Resolving rollback conflicts

The chat-service's HTTP /rollback route attempted to git revert -m 1 <sha> each merge commit on the base branch, and one of them conflicted. It aborted that revert and handed you the failed commit plus every commit it still had left to undo. Your job: replay them against the current base branch, resolving conflicts as you go. You are dispatched alone — no team, no peers. The merger is dispatched separately by the orchestrator after you stop.

The conflict exists because a later session edited the same lines this rollback wants to undo. That conflict only shows up against the current base branch — not against the stale session/<SESSION_SHORT_ID> your worktree was forked from. So your first step realigns your branch onto BASE_BRANCH; then the revert reproduces the real conflict for you to resolve, and the merger's promotion fast-forwards cleanly afterward.

Spawn prompt — what you receive

ROLE: developer
WORKTREE_PATH: <WORKTREE_BASE>/simple
BRANCH_NAME: <SESSION_SHORT_ID>/simple
BASE_BRANCH: <the default branch, e.g. master — the promotion target>
FAILED_COMMIT: <short sha> ("<subject>")
COMMITS_TO_REVERT:
  - <sha>    # <subject>
  - ...

Working directory is <WORKTREE_PATH> — the shared <base>/simple worktree the setup-worktree hook creates for you. Every Bash call must cd <WORKTREE_PATH> && … (shell state is stateless between calls). Do NOT touch $CLAUDE_PROJECT_DIR/src/... — that's the base branch.

Output contract

Your very last line of output MUST be exactly one of:

  • DONE: branch=<SESSION_SHORT_ID>/simple files=[<every file you touched, deduped>]
  • FAILED: <one-line, plain-English reason — say what was confusing>

The orchestrator's STATE RB-MERGE relies on those literal prefixes.

Workflow

Step 0 — Realign your branch onto the base branch (do this ONCE, first)

Your worktree was forked from the stale session/<SESSION_SHORT_ID>, where the conflicting later changes don't exist — revert there and it applies cleanly but the conflict resurfaces, unresolved, at promotion. Reset your branch onto the current base branch so you replay the reverts against the exact state the HTTP route hit the conflict on:

bash
cd <WORKTREE_PATH> && git reset --hard <BASE_BRANCH>

This is the only branch-moving command you may run, and only here. After it, proceed to the loop below.

Then, for each SHA in COMMITS_TO_REVERT, in the order given:

Step 1 — Read the commit you're about to undo

Before touching anything, get the canonical record of what this commit changed. This is the ground truth you'll use to resolve conflicts and to interpret empty reverts:

bash
cd <WORKTREE_PATH> && git show --stat <sha>          # which files, how big
cd <WORKTREE_PATH> && git show <sha>                  # full diff

Read the diff. Identify, in your head, exactly what this commit added (the + lines on the "after" side) and what it replaced (the - lines). The revert's job is to remove the + and put back the - — nothing else.

Step 2 — Attempt the revert

bash
cd <WORKTREE_PATH> && git revert --no-edit -m 1 <sha>

Three possible outcomes — match yours below.

Outcome A — Clean revert with real changes

git revert exited 0 AND git diff --name-only HEAD^ HEAD is non-empty. Sanity-check: do the changed files / changed lines match what Step 1 told you to expect? If yes, go to next SHA.

Outcome B — Empty revert (clean exit, zero changes)

git revert exited 0 BUT git diff --name-only HEAD^ HEAD is empty.

This means a later commit on the base branch has already removed or transformed the lines your target commit added. Two sub-cases:

  • B1 — Pure substitution (e.g. target said X → Y, current main says Z): the user's intent — "undo X → Y" — can sometimes still be expressed as Z → X. Look at Step 1's + strings; grep current main for them; if they're absent but the file at the same location now has a different value, that's the later commit's overwrite. Edit the file to replace that later value with the original - strings from Step 1. Then commit with the revert marker so a future rollback knows this commit was already undone:
    bash
    cd <WORKTREE_PATH> && git add -A && git commit -m "revert: semantic revert of <sha-short>" -m "This reverts commit <FULL 40-char sha>."
    The second -m line is mandatory: the chat-service detects already-reverted commits by scanning for This reverts commit <sha>. Native git revert / git revert --continue write this marker automatically; a manual semantic revert must add it explicitly or the commit will be re-reverted on the next rollback. Re-check with git diff --name-only HEAD^ HEAD — it should be non-empty now.
  • B2 — Target already fully absent (the later commit removed the addition entirely, no equivalent value to swap): the target commit's effect is already gone from main. Nothing to revert.
    bash
    cd <WORKTREE_PATH> && git reset --hard HEAD^
    FAILED: revert of <sha> produced no changes — its additions have already been removed by a later commit

If you're unsure which sub-case applies, prefer B2 (FAILED) — a confusing-but-honest failure is better than a hallucinated edit that touches files the user didn't expect.

Outcome C — Conflict (non-zero exit, unmerged paths)

git status shows You are currently reverting commit <sha> plus UU/AA/DU/UD entries.

bash
cd <WORKTREE_PATH> && git status --porcelain
cd <WORKTREE_PATH> && git diff --diff-filter=U

For each conflict file, the markers look like:

<<<<<<< HEAD
<current state on the base branch — includes whatever later commits added>
=======
<state after applying the revert — the target commit's additions are removed,
 but later commits' additions on the SAME lines might also be missing here>
>>>>>>> parent of <sha>...

Goal: produce a version where the target commit's + lines (from Step 1) are removed, but every later commit's contribution that you can identify is preserved.

Heuristic, in order:

  1. Read both sides side-by-side. Identify which lines come from the target commit's + (look at Step 1's diff) and which come from later commits.
  2. Keep: everything on the "HEAD" side that does NOT correspond to one of the target commit's + lines.
  3. Drop: the target commit's + lines (and only those).
  4. If the target commit added a whole new function/file/component that's now referenced elsewhere, you'll need to also remove those references — but only the references that exist because of the target commit. The SubagentStop hooks (typecheck, unit tests, e2e) run after you stop; if they fail with Cannot find name 'X' for some X that the target commit introduced, that's your signal to remove the reference. If they fail for something the target commit DIDN'T introduce, you went too far — revert your last edit.

After resolving every conflict file:

bash
cd <WORKTREE_PATH> && git add -A && git revert --continue --no-edit

Then re-check git diff --name-only HEAD^ HEAD. If empty, apply the Outcome B logic. Otherwise, go to next SHA.

Step 3 — All SHAs processed

Emit the output contract:

DONE: branch=<SESSION_SHORT_ID>/simple files=[<every file you touched, deduped>]

The orchestrator's STATE RB-MERGE will dispatch the single-shot merger to merge your branch back into the base.

Step 4 — Unrecoverable failure

If at any point you can't make progress (a conflict you genuinely can't read, three rounds of validation hook failures with no fix in sight, etc.):

bash
cd <WORKTREE_PATH> && git revert --abort 2>/dev/null || true
FAILED: rollback merge failed: <one-line, plain-English reason — say what was confusing>

NEVER while resolving a rollback conflict

  • ❌ Run git merge, git push, git checkout, --no-verify. The only branch-moving commands allowed are: git reset --hard <BASE_BRANCH> exactly once at Step 0, and git reset --hard HEAD^ to undo your own empty revert as documented in Outcome B.
  • ❌ Edit anything outside <WORKTREE_PATH>/. Never edit $CLAUDE_PROJECT_DIR/... directly, never edit .git/ internals.
  • ❌ Drive-by refactors, prettier formatting changes, or unrelated edits. Edits must be caused by the revert (target additions to remove) or by a typecheck/unit/e2e failure that the revert created.
  • ❌ Dispatch agents or SendMessage — you are solo here.
  • ❌ Stop without either DONE: or FAILED: — the orchestrator's STATE RB-MERGE relies on those literal prefixes.

Frequently asked questions

What does the Resolving Rollback Conflicts AI skill do?

Replay a list of git-revert commits against the current base branch and resolve the conflicts, when the chat-service's automatic rollback hit a merge conflict it couldn't resolve. Load this when your developer dispatch asks you to resolve a rollback conflict (it carries BASE_BRANCH, FAILED_COMMIT, COMMITS_TO_REVERT). This is NOT a feature ticket — the workflow below replaces the normal ticket rules.

Why use Resolving Rollback Conflicts on TypingMind?

Because you install it once and use it with any model. Resolving Rollback Conflicts is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Resolving Rollback Conflicts in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/marmelab/atomic-crm/tree/main/.claude/skills/resolving-rollback-conflicts. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Resolving Rollback Conflicts?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Resolving Rollback Conflicts?

As many as you like. As long as a model supports skills, you can use Resolving Rollback Conflicts with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Resolving Rollback Conflicts AI skill free?

Yes. It is published on GitHub by marmelab under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇