Skip to content
Agentmart
Submit a tool

git-worktrees

Use before any command that changes branch state - git checkout -b, git switch -c, git worktree add - and when asked where a worktree goes, whether to branch…

Skill by carlosboeing

IndexedMIT★ 3
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/carlosboeing-git-worktrees

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Use before any command that changes branch state - git checkout -b, git switch -c, git worktree add - and when asked where a worktree goes, whether to branch in place, or how to recover a commit made on the wrong branch. States the cross-harness worktree path convention and the two corrections to superpowers:using-git-worktrees.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/git-worktrees

What's inside

Skill name
git-worktrees
Description
Use before any command that changes branch state - git checkout -b, git switch -c, git worktree add - and when asked where a worktree goes, whether to branch in place, or how to recover a commit made on the wrong branch. States the cross-harness worktree path convention and the two corrections to superpowers:using-git-worktrees.
License
MIT
Instructions
55 lines in SKILL.md · view on GitHub

Files (2)

  • README.md
  • SKILL.md

SKILL.md (first lines)

# Git worktrees

Every harness uses one path convention: `<repo>/.worktrees/<harness>/<branch>`. Claude Code is included, and there is no native-tool exception.

## The path

- Put worktrees inside the repository under `.worktrees/`, never in a sibling directory.
- Verify `.worktrees/` is git-ignored first, with `git check-ignore -q .worktrees/`.
- If the entry is missing, add it, create the worktree, then commit the entry from inside the new worktree rather than from the shared checkout.
- Harness segment names: `codex`, `cursor`, `agy`, `kimi`, `grok`, `opencode`, `claude`.
- Keep the branch name intact, slashes included. Branch `feat/foo` under Claude Code goes to `.worktrees/claude/feat/foo`, so `git worktree list` prints the branch name back to you.

A nested working-memory repository has its own worktrees. `.workbench/` is a separate repository, and its worktrees go under `.workbench/.worktrees/<harness>/<branch>`. The outer repository's `git worktree list` reports nothing about them.

## When to create one

Worktrees are for implementation, not for thinking. Brainstorm, discovery, design and plan work happens in the main checkout, with no branch and no worktree.

At implementation, ask before the first command that changes branch state: "Worktree, or branch in place?" Do not decide silently in either direction.

One case is not a question. If `git worktree list` prints more than one entry for the repository, another session is live in it.

Creating a branch in one worktree does not move other worktrees' HEADs or discard their edits; each worktree has its own HEAD and its own uncommitted state. The rule stands for isolation: sessions that share one working tree interleave edits and branch switches in a tree none of them owns. Create the worktree and say why.

## Check for company first

Run `git worktree list` before any branch command. Run `git -C .workbench worktree list` too, where that repository exists.

## Recover, do not discard

If a commit goes to the wrong branch, confirm its content exists elsewhere before you drop it. Then rebase `--onto` the right base and push with `--force-with-lease`.

## Create one

1. Run `git fetch`, then `git worktree list`.
2. Confirm `.worktrees/` is ignored, as above.
3. Run `git worktree add -b <branch> .worktrees/<harness>/<branch> origin/main`, branching off `origin/main` rather than a local `main` that may have diverged.
4. Work, test, and commit from inside the new worktree.

## Harness notes

| Harness | Rule |
|---|---|
| Claude Code | Manual convention. `EnterWorktree` is not used, because one path per harness beats two. |
| Codex CLI, Gemini CLI / Antigravity, Kimi Code | Manual convention. |
| Cursor | Manual convention, unless the project configures `worktree.json`. |
| Grok Build TUI | Native session worktrees live under `~/.grok/worktrees/`. Manual worktrees use `.worktrees/grok/<branch>`. |

An explicit worktree location in project instructions takes precedence over every rule in this skill.

## Seeing them in VS Code

Set `git.detectWorktrees` to `true`, because it defaults to `false`. Each detected worktree then appears as its own repository in Source Control, and its uncommitted changes become diffable without a second window.

From carlosboeing/agentic-toolkit, MIT.

More from carlosboeing/agentic-toolkit

Signals

Stars
3
Forks
0
Open issues
1
Last commit (this folder)
Oct 3, 2026 (26 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from carlosboeing

Cite this page

git-worktrees skill. Agent Mart. https://agentmart.dev/skills/carlosboeing-git-worktrees (last updated 2026-10-24)