worktree
Ce qu’il fait
Elle met en place des worktrees git isolés, c'est-à-dire des copies supplémentaires d'un projet sur leur propre branche, stockées dans un dossier Vibe. Elle s'adresse aux développeurs qui travaillent sur plusieurs tâches dans un même dépôt.
Quand l’utiliser
- ✓Quand vous voulez travailler sur une tâche dans une copie séparée d'un projet git.
- ✓Quand vous voulez démarrer une nouvelle branche dans son propre worktree pour une tâche.
- ✓Quand vous voulez lister ou supprimer des worktrees dont vous n'avez plus besoin.
Lien du skill
https://github.com/mistralai/mistral-vibe/blob/main/vibe/plugins/builtins/vibe/skills/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 worktree git séparé pour ma correction du bug de connexion afin que mon travail principal reste intact.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
La compétence crée un dossier nommé pour le worktree et note l'endroit d'où il part. Elle tient un registre de chaque worktree pour pouvoir le retrouver et le supprimer plus tard.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Worktree Management
Git worktrees live under $VIBE_HOME/worktrees/ (default ~/.vibe/worktrees/),
each in a per-repository bucket named <repo_root.name>-<sha256(common_git_dir)[:12]>
so worktrees from different repos never collide.
$VIBE_HOME/worktrees/
.claims/<bucket>/<name>/ # claim records and holder markers
record.json # metadata: branch, base_commit, branch_created, claimed_at
recovery.json # snapshot metadata for a retained chat
holders/ # one empty file per live session
<bucket>/<name>/ # the actual git worktree checkout
Creating a worktree
- Compute the bucket from the repo root and common git dir.
- Validate the name (single portable path segment; no
<>:"/\|?*, no trailing space or dot, no Windows reserved names likeCON/PRN/NUL/COM1-COM9/LPT1-LPT9, not.or..). - Reserve the directory with
mkdir(atomic claim — fails if taken). - For a new branch, start from the remote's default branch (fetch first, best-effort). For an existing branch, check it out into the worktree.
git worktree add -b <name> <path> <start_point>(or without-bfor reuse).- Record the worktree's own HEAD as
base_commit— this is the baseline for cleanup, not the invoking checkout's HEAD. - Write
record.jsonunder.claims/<bucket>/<name>/.
When no name is given, derive one by slugifying the prompt: NFKD-normalize,
lowercase, replace non-[a-z0-9]+ with -, take the first 6 words, trim to
40 chars, drop trailing stop words. Branch gets a vibe/ prefix. Append
-2, -3, etc. on collision (up to 100). Fall back to a random slug if empty.
Reuse an existing worktree only after validating: no symlinks in the path,
.git is a file (not a directory), same common git dir, matching branch.
Holding
A session using a worktree must register as a holder to prevent the background cleanup from removing it. Holder files are locked for the lifetime of the session; an unlocked marker left by a crashed process is stale and may be removed. A temporary holder protects a worktree while a session attaches.
Cleaning up
Before removal, inspect the worktree state:
- Uncommitted changes or untracked files:
git -c core.fsmonitor= status --porcelain --untracked-files=all - New commits since start:
git rev-list --count <base_commit>..HEAD
The worktree is clean only if all three are absent. If dirty, confirm with the user before proceeding — removal discards uncommitted work, untracked files, and new commits.
If the branch pre-existed (not created by this session), confirm separately
before deleting it. Re-check holders — if another session still holds the
worktree, keep it. cd out of the worktree before removing (Windows refuses
to delete a process's cwd).
Remove: git worktree remove --force <path>, then git branch -D <name> if
the branch was created this session or the user confirmed. Delete the claim
record and rmdir empty directories (never rmtree — a surviving holder
must not be lost).
Snapshotting
Before retention removes an inactive worktree, save its state to a ref: stage
all files (including untracked, excluding ignored) and commit to
refs/vibe/reaped/<name>. Use a separate index file so the worktree's own
index is untouched. Keep recovery.json after removing the active claim so
reopening a chat can recreate the checkout automatically.
Retention
Keep the newest configured number of managed worktrees across repositories.
Skip active worktrees. Snapshot each inactive excess worktree before removal;
if snapshotting fails, keep it. Reservations without a base_commit are
discarded only if empty and no creation process still holds their marker.
Creation, attachment, and retention transitions use a cross-process lock so a worktree cannot be removed while another process is claiming or attaching it.
Gotchas
- Disable
core.fsmonitorwhen reading someone else's working tree:git -c core.fsmonitor= status. - New branches start from the remote default branch, not the current checkout's HEAD.
- Symlink paths are rejected — not a stable worktree path.
git worktree addcannot distinguish a taken path from an invalid ref (both exit 128), somkdirreserves the path first.- Worktrees are implicitly trusted for the session only, not persisted.
Questions fréquentes
Où sont conservés les worktrees ?
Dans un dossier worktrees à l'intérieur de votre dossier personnel Vibe, regroupés par dépôt.
Un worktree peut-il contenir des espaces ou des caractères spéciaux ?
Non. Le nom doit être un nom de dossier simple, sans caractères comme les barres obliques ou les points d'interrogation.
Cela fait-il basculer mon dossier de projet principal sur la nouvelle branche ?
Non. Le worktree est une copie séparée, donc votre dossier principal reste tel quel.
Détails
Description originale de l’auteur
Create, reuse, and clean up git worktrees under $VIBE_HOME/worktrees. Use when the user wants to work in an isolated git worktree, create a worktree for a task, or list/remove existing worktrees.
repo: mistralai/mistral-vibe
Popularité
- Étoiles GitHub
- 5.3k
- Position au classement
- #15011
- Licence
- Apache-2.0
- Mis à jour
- 02/11/2026
Commentaires
- …
Autres skills de ce dépôt
create-plugin
5.3kAide votre agent à créer un paquet d'extension pour Mistral Vibe, avec compétences, outils et paramètres regroupés.
skill-creator
5.3kApprend à votre agent à créer, mettre à jour ou supprimer une compétence Mistral Vibe, en vous demandant d'abord les détails dont il a besoin.
vibe
5.3kAide votre agent à répondre aux questions sur Mistral Vibe lui-même, y compris ses paramètres, ses dossiers, ses commandes et la manière de les modifier.
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.