Worktree Merge logo

Worktree Merge

Community
coleam00
worktree-merge

Integrate any number of feature branches from parallel worktrees through one safe integration branch, validating after each merge and running the project's full check suite before touching the main line. Use when parallel worktree development is done and the branches need to be merged, or when the user says "merge my worktrees", "integrate these branches", or invokes /worktree-merge.

Overview

Publishercoleam00
Repositoryskills
Skill nameworktree-merge
Stars
678
Forks
184
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 coleam00 on GitHub. Read the source before you install it.

Installation

Install the Worktree Merge 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/coleam00/skills/tree/main/.claude/skills/worktree-merge
  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/coleam00/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/.claude/skills/worktree-merge .claude/skills/worktree-merge
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Worktree Merge 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 Worktree Merge 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 Worktree Merge 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.

Worktree Merge

Integrate any number of feature branches into your working branch through a single throwaway integration branch, so nothing lands on the main line until every branch is merged and the whole suite passes. Validation commands are detected from the repo, never assumed.

Input

$ARGUMENTS is the list of branches to integrate.

  • Fewer than two → ask which branches to integrate. Don't guess.
  • Two or more → integrate them in the given order.

Detect the validation commands ONCE

Find the commands that prove this project works, preferring what CI already runs: read .github/workflows/*, a Makefile, or the manifest's test/lint scripts, and reuse those exact commands (test runner, type checker, linter). Do not hardcode pytest/mypy/pyright — use whatever this repo actually uses.

Steps

  1. Preconditions. Confirm you're at the repository root, not inside worktrees/ ([[ $(pwd) =~ /worktrees/ ]] → error). Store the current branch. Verify every branch in the list exists (git rev-parse --verify <branch>). Abort early with a clear message if any check fails.

  2. Create one integration branch off the current branch, named for the set (e.g. integration-<first>, with a short suffix if there are several — keep it filesystem-safe). This is where merges are tested; the main line stays untouched until the end.

  3. Merge each branch in order, --no-ff. After each merge, run the detected test command so a break is localized to the branch that caused it.

    • On conflict: stop, name the conflicting branch and files, and give resolution steps (resolve → git add → git commit → re-run the skill). Don't attempt automatic resolution.
    • On test failure: stop, report which tests failed, and give the rollback (git checkout <original> → git branch -D <integration>).
  4. Full validation once all branches are merged: run the project's complete detected suite (tests + type checks + lint). Any failure → report it and roll back; nothing reaches the main line red.

  5. Merge the integration branch into the original branch (--no-ff), then delete the integration branch.

  6. Offer cleanup with AskUserQuestion: remove the N worktrees and delete their feature branches, or keep them. On yes, for each branch: git worktree remove worktrees/<branch> and git branch -d <branch>.

Report

  • Success: the integration branch used, each branch merged (with its post-merge test result), the full validation result, the merge into <original>, and cleanup status (worktrees kept or removed, with the manual cleanup commands if kept).
  • Failure: the step and branch that failed, the current branch state, and exact rollback commands (git checkout <original> → git branch -D <integration>), plus how to continue after fixing (re-run with the same branch list).

Notes

  • --no-ff preserves each feature branch's history.
  • The integration branch is disposable — the original branch only moves after every merge and the full suite pass.
  • Prefer opening a PR per branch when you're on a team; this skill is for fast local integration when you own the merge.

Frequently asked questions

What does the Worktree Merge AI skill do?

Integrate any number of feature branches from parallel worktrees through one safe integration branch, validating after each merge and running the project's full check suite before touching the main line. Use when parallel worktree development is done and the branches need to be merged, or when the user says "merge my worktrees", "integrate these branches", or invokes /worktree-merge.

Why use Worktree Merge on TypingMind?

Because you install it once and use it with any model. Worktree Merge 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 Worktree Merge in TypingMind?

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

Which AI models can use Worktree Merge?

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 Worktree Merge?

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

Is the Worktree Merge AI skill free?

Yes. It is published on GitHub by coleam00 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 👇