ce-worktree
Ce qu’il fait
Il crée un espace de travail isolé sur une branche nouvelle ou existante, afin que votre dossier principal reste intact. Il s'adresse aux développeurs qui travaillent sur plusieurs tâches dans un même dépôt.
Quand l’utiliser
- ✓Quand vous commencez un nouveau travail et voulez le garder à l'écart de votre copie principale.
- ✓Lorsque vous voulez récupérer une pull request ou un commit dans son propre dossier.
- ✓Lorsqu'une branche est déjà extraite ailleurs, la skill indique cet emplacement au lieu de créer une seconde copie.
Lien du skill
https://github.com/EveryInc/compound-engineering-plugin/blob/main/skills/ce-worktree/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Crée un espace de travail séparé pour cette fonctionnalité, pour que mon dossier principal reste intact.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
Il vérifie d'abord si le travail est déjà isolé, puis utilise l'outil de worktree intégré ou git simple pour créer le nouvel espace, et indique son chemin et sa branche.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Worktree Isolation
Ensure the current work happens in an isolated workspace, without disturbing the user's main checkout. Most coding harnesses now create a worktree by default at session start, so the common case is that isolation already exists.
Done when: the caller is working in an isolated tree — existing or newly created — and its path and branch have been reported, or a blocker has been reported instead.
Order of operations: detect existing isolation -> prefer a native worktree tool -> fall back to plain git. Never create a worktree the harness cannot see.
Two modes, set by the caller's need:
- New work (default). No ref named — create a fresh branch from a base (trunk). This is what
ce-workandce-code-reviewuse when the user picks the worktree option. - Isolate an existing ref. The caller names a PR head, branch, or commit — attach the worktree to that ref instead of creating a new branch. A branch can be checked out in only one worktree at a time. If the named ref is already checked out anywhere (most commonly as the primary checkout's current branch), do not create a second worktree — report that it is already checked out at
<path>and let the caller act (work there in place; or, only if a clean separate tree is essential, create a detached worktree at the same commit).
Step 0: Detect existing isolation
Compare the resolved absolute git dir against the resolved absolute common git dir. Git mixes absolute and relative forms depending on the current directory (from a subdirectory of a normal checkout, --git-dir comes back absolute while --git-common-dir may be relative), so a raw string compare yields a false "already isolated":
git rev-parse --absolute-git-dir # absolute git dir for this worktree
(cd "$(git rev-parse --git-common-dir)" && pwd -P) # absolute shared (common) git dir
Equal -> normal checkout; continue to Step 1.
Different -> a linked worktree or a submodule. Distinguish with git rev-parse --show-superproject-working-tree:
- Non-empty -> submodule; treat it as a normal checkout and continue to Step 1.
- Empty -> already isolated. Report the worktree path (
git rev-parse --show-toplevel) and current branch, then work in place — a worktree-from-worktree lands in the wrong tree and is invisible to the harness that made the current one. In isolate-an-existing-ref mode, check that ref out here (unless it is already current) rather than nesting a worktree.
Step 1: Prefer the harness's native worktree tool
If the harness provides a native worktree primitive — for example an EnterWorktree / WorktreeCreate tool, a /worktree command, or a --worktree flag — use it and stop. Native tools place, track, and clean up the worktree so the harness can manage it. A behind-the-back git worktree add creates phantom state the harness cannot see, navigate to, or clean up.
Step 2: Git fallback
Only when there is no native tool and Step 0 found no existing isolation.
- Run from the repo root:
cd "$(git rev-parse --show-toplevel)". The paths below are repo-root-relative, but the skill runs from the user's current directory — without this,.worktrees/<branch>and the.gitignoreedit land in a subdirectory (e.g.src/.worktrees/...). - Choose a meaningful branch name from the work description (e.g.
feat/login,fix/email-validation) — never an opaque auto-generated one. Base: origin's default branch, elsemain. - Ensure
.worktrees/is gitignored before creating anything:git check-ignore -q .worktrees/— with the trailing slash, so an existing directory-only.worktrees/rule is honored even before the directory exists (without the slash the probe misses it and dirties a correctly-configured repo). Not ignored -> add a.worktrees/line to.gitignore. - Refresh the base with
git fetch origin <from-branch>. This is non-fatal — nooriginremote, a differently-named remote, or a local-only branch is not an abort; continue with the local ref. - Create the worktree, per mode:
- New work:
git worktree add -b <branch-name> .worktrees/<branch-name> origin/<from-branch>(use the local<from-branch>ref iforigin/<from-branch>does not exist). - Existing branch or tag:
git worktree add .worktrees/<slug> <target-ref>. - PR: check it out on a local branch —
git fetch origin pull/<n>/head:pr-<n>then `
- New work:
Questions fréquentes
Cela modifiera-t-il ma copie principale ?
Non. Il est conçu pour ne pas perturber votre copie principale.
Peut-il se rattacher à une branche de pull request existante ?
Oui. Il peut rattacher un worktree à une branche existante, à une pull request ou à un commit.
Que se passe-t-il si la branche est déjà utilisée ?
Il vous indique où la branche est extraite, et c'est vous qui décidez de la suite.
Détails
Description originale de l’auteur
Set up isolated git worktrees — create a new branch for fresh work, or attach a worktree to an existing branch, PR, or commit. Use when starting isolated work or isolating an existing ref.
Popularité
- Étoiles GitHub
- 26k
- Position au classement
- #10052
- Licence
- MIT
- Mis à jour
- 02/11/2026
Commentaires
- …
Autres skills de ce dépôt
ce-babysit-pr
26kAide votre agent à faire avancer une pull request GitHub ouverte vers la fusion, en traitant dans le temps les commentaires de revue, les vérifications en échec et les branches obsolètes.
ce-bakeoff
26kAide votre agent à élaborer plusieurs solutions concurrentes à un problème, à les comparer et à combiner les meilleures parties en une seule approche recommandée.
ce-brainstorm
26kAide votre agent à transformer une idée vague en un ensemble d'exigences clair et bien dimensionné avant tout travail, grâce à un bref échange guidé.
ce-code-review
26kAide votre agent à relire une modification de code ou une pull request donnée pour détecter les bugs, les régressions, les tests manquants et les problèmes de normes, puis à présenter des constats clairs.
Skills similaires
diffs
394kPermet à votre agent de produire un diff réel et partageable de vos modifications, sous forme de lien ou d'image, plutôt qu'un résumé écrit à la main.
coding-agent
394kAide votre agent à confier une tâche de programmation plus importante à Codex, Claude Code ou OpenCode comme travailleur en arrière-plan, puis à suivre sa progression.
gh-issues
394kAide votre agent à trouver des tickets GitHub, choisir ceux à traiter et ouvrir des pull requests avec des correctifs, y compris le suivi des commentaires de relecture.