agentleFS
KbWenKbWen/agentic-os/.agents/skills/using-git-worktrees/SKILL.md

using-git-worktrees

Skill224 starsChanged 20 days agoMITView on GitHub

Use Git worktrees to create parallel working directories safely; avoid branch-switch contamination.

We split this skill into the rules it gives an agent

5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 180 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Avoid confusing or overwriting existing workspaces.

    line 16
  2. Distinctive:

    Ensure the primary workspace is clean (prevent taking uncommitted changes).

    line 23
  3. Distinctive:

    Check that the target directory does not exist or is empty.

    line 25
  4. Distinctive:

    Create a branch and add a worktree:

    line 31
  5. Distinctive:

    Remove the worktree when finished (if no longer needed):

    line 35

“Common” is measured: kept by at least 6 in 10 of the 180 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Using Git Worktrees

Overview

Git worktree allows mounting multiple working directories onto the same repository simultaneously, each mapped to a different branch. This is ideal for parallel development and hotfixes.

Workspace Selection Principles

  • Manage them centrally outside the repo or in a dedicated folder (e.g., ../wt-<task>).
  • Name them with task semantics (feature/hotfix + short name).
  • Avoid confusing or overwriting existing workspaces.

Safety Checks

  1. Detect nesting first — do not create a worktree from inside another worktree or a submodule:
    • You are already in a linked worktree if git rev-parse --git-dir differs from git rev-parse --git-common-dir (they match in the main worktree). cd to the main worktree before adding.
    • You are in a submodule if git rev-parse --show-superproject-working-tree is non-empty. Operate on the intended repo, not the submodule.
  2. Ensure the primary workspace is clean (prevent taking uncommitted changes).
  3. List existing worktrees first: git worktree list.
  4. Check that the target directory does not exist or is empty.
  5. Keep the worktree path out of the tracked tree — prefer a sibling dir (../wt-<task>). If it must live inside the repo, verify it is ignored first: git check-ignore -q <path> (exit 0 = ignored). A non-ignored in-repo worktree pollutes the parent's git status and can be committed by accident.
  6. Confirm branch naming and tracking strategies.

Setup Workflow

  1. Create a branch and add a worktree:
    • git worktree add ../wt-<task> -b <branch-name>
  2. Switch to the new directory and run a baseline test.
  3. Develop, commit, and verify independently in that directory.
  4. Remove the worktree when finished (if no longer needed):
    • git worktree remove ../wt-<task>

Common Mistakes

  • Committing in the wrong worktree.
  • Deleting a worktree without confirming if the branch should be preserved.
  • Chaotic directory naming, leading to unclear task mapping.

Download now (ZIP)

  • Other versions189 projects use a version of this.

    Word for word · 1

    1. KbWen/agent-virtual-office★ 65100% same

    Edited · 0

    None found.

    Wrote their own version · 188

    1. obra/superpowers★ 305ksame name
    2. jnMetaCode/superpowers-zh★ 8.4ksame name
    3. openai/plugins★ 7.4ksame name
    4. farm-fe/farm★ 5.6ksame name
    5. microsoft/FluidFramework★ 5ksame name
    6. silvertakana/worldwideview★ 1.9ksame name
    7. GanyuanRan/Aegis★ 1.4ksame name
    8. pcvelz/superpowers★ 1.3ksame name
    9. usewhale/DeepSeek-Code-Whale★ 933same name
    10. usewhale/Whale★ 928same name

    178 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use chinese-code-review, chinese-commit-conventions and 10 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • GEd520Skill

      chinese-code-review

      中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。

      Also in 7 projects that use this

    • GEd520Skill

      chinese-commit-conventions

      中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。

      Also in 7 projects that use this

    • obraSkill

      diagnosing-superpowers

      Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

      Also in 12 projects that use this

    • 10CGSkill

      workflow-runner

      十步循环轻量编排器,协调 Phase Skills 执行,支持灵活组合。

      Also in 7 projects that use this

    • xfstudioSkill

      test-fixing

      Run tests and systematically fix all failing tests using smart error grouping. Use when user asks to fix failing tests, mentions test failures, runs test suite and failures occur, or requests to make tests pass.

      Also in 3 projects that use this

    • kntismSkill

      condition-based-waiting

      Use when tests have race conditions, timing dependencies, or inconsistent pass/fail behavior - replaces arbitrary timeouts with condition polling to wait for actual state changes, eliminating flaky tests from timing guesses

      Also in 3 projects that use this

    • +2 more from GEd520
  • In this repository17 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.