worktree
यह क्या करती है
यह अलग git worktree सेट करती है, यानी किसी प्रोजेक्ट की अलग कॉपी जो अपनी ब्रांच पर होती है और Vibe फ़ोल्डर में रहती है। यह उन डेवलपर्स के लिए है जो एक ही रिपॉज़िटरी में कई काम करते हैं।
कब इस्तेमाल करें
- ✓जब आप किसी git प्रोजेक्ट की अलग कॉपी में एक काम करना चाहते हैं।
- ✓जब आप एक काम के लिए अपनी worktree में नई ब्रांच शुरू करना चाहते हैं।
- ✓जब आप अब ज़रूरत न होने वाली worktree की सूची देखना या हटाना चाहते हैं।
Skill का लिंक
https://github.com/mistralai/mistral-vibe/blob/main/vibe/plugins/builtins/vibe/skills/worktree/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे लॉगिन बग के फ़िक्स के लिए अलग git worktree बनाइए, ताकि मेरा मुख्य काम बदले बिना रहे।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
स्किल worktree के लिए एक नाम वाला फ़ोल्डर बनाती है और दर्ज करती है कि वह कहाँ से शुरू हुआ। वह हर worktree का रिकॉर्ड रखती है ताकि बाद में उसे ढूँढा और हटाया जा सके।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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.
अक्सर पूछे जाने वाले सवाल
Worktrees कहाँ रखे जाते हैं?
आपके Vibe होम के अंदर एक worktrees फ़ोल्डर में, रिपॉज़िटरी के हिसाब से समूहित करके।
क्या worktree के नाम में स्पेस या खास अक्षर हो सकते हैं?
नहीं। नाम एक सरल फ़ोल्डर नाम होना चाहिए, जिसमें स्लैश या प्रश्न चिह्न जैसे अक्षर न हों।
क्या यह मेरा मुख्य प्रोजेक्ट फ़ोल्डर नई ब्रांच पर बदल देती है?
नहीं। worktree एक अलग कॉपी है, इसलिए आपका मुख्य फ़ोल्डर जैसा है वैसा ही रहता है।
जानकारी
लेखक का मूल विवरण
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
लोकप्रियता
- GitHub स्टार
- 5.3k
- रैंकिंग में स्थान
- #15011
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
create-plugin
5.3kयह आपके एजेंट को Mistral Vibe के लिए प्लगइन पैकेज बनाने में मदद करती है, जिसमें स्किल, टूल और सेटिंग एक साथ बंडल होते हैं।
skill-creator
5.3kयह आपके एजेंट को Mistral Vibe स्किल बनाना, अपडेट करना या हटाना सिखाती है, और पहले ज़रूरी विवरण पूछती है।
vibe
5.3kयह आपके एजेंट को Mistral Vibe के बारे में सवालों के जवाब देने में मदद करती है, जिसमें उसकी सेटिंग, फ़ोल्डर, कमांड और उन्हें बदलने के तरीके शामिल हैं।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।