मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग26k · #10052

ce-worktree

यह क्या करती है

यह एक नई या मौजूदा ब्रांच पर अलग वर्कस्पेस बनाती है, ताकि आपका मुख्य फ़ोल्डर जैसा है वैसा ही रहे। यह उन डेवलपर्स के लिए है जो एक ही रिपॉज़िटरी में कई काम करते हैं।

कब इस्तेमाल करें

  • ✓जब आप नया काम शुरू करें और चाहें कि वह आपके मुख्य चेकआउट से अलग रहे।
  • ✓जब आप किसी पुल रिक्वेस्ट या कमिट को उसके अपने फ़ोल्डर में चेकआउट करना चाहें।
  • ✓जब कोई ब्रांच पहले से कहीं चेकआउट हो, तो यह दूसरी कॉपी बनाने के बजाय उसकी जगह बताती है।

Skill का लिंक

https://github.com/EveryInc/compound-engineering-plugin/blob/main/skills/ce-worktree/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/EveryInc/compound-engineering-plugin/blob/main/skills/ce-worktree/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“इस फ़ीचर के लिए एक अलग वर्कस्पेस सेट कीजिए, ताकि मेरा मुख्य फ़ोल्डर न छेड़ा जाए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह पहले जाँचती है कि काम पहले से अलग है या नहीं, फिर बिल्ट-इन worktree टूल या सादे git से नया वर्कस्पेस बनाती है, और उसका पाथ व ब्रांच बताती है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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-work and ce-code-review use 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.

  1. 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 .gitignore edit land in a subdirectory (e.g. src/.worktrees/...).
  2. 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, else main.
  3. 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.
  4. Refresh the base with git fetch origin <from-branch>. This is non-fatal — no origin remote, a differently-named remote, or a local-only branch is not an abort; continue with the local ref.
  5. 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 if origin/<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 `
अक्सर पूछे जाने वाले सवाल

क्या इससे मेरा मुख्य चेकआउट बदलेगा?

नहीं। इसे मुख्य चेकआउट को छेड़ने से बचाने के लिए बनाया गया है।

क्या यह मौजूदा पुल रिक्वेस्ट ब्रांच से जुड़ सकती है?

हाँ। यह worktree को मौजूदा ब्रांच, पुल रिक्वेस्ट या कमिट से जोड़ सकती है।

अगर ब्रांच पहले से इस्तेमाल में हो तो?

यह बताती है कि ब्रांच कहाँ चेकआउट है, और आगे क्या करना है यह आप तय करते हैं।

जानकारी

लेखक का मूल विवरण

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.

repo: EveryInc/compound-engineering-plugin

लोकप्रियता

GitHub स्टार
26k
रैंकिंग में स्थान
#10052
लाइसेंस
MIT
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

ce-babysit-pr

26k

यह आपके एजेंट को खुली GitHub पुल रिक्वेस्ट को समय के साथ मर्ज की ओर बढ़ाते रहने में मदद करती है, रिव्यू टिप्पणियाँ, विफल जाँचें और पुरानी ब्रांच सँभालकर।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

ce-bakeoff

26k

यह आपके एजेंट को किसी समस्या के कई प्रतिस्पर्धी समाधान बनाने, उनकी तुलना करने और सबसे मज़बूत हिस्सों को मिलाकर एक सुझाया गया तरीका बनाने में मदद करती है।

प्रोडक्टिविटीटास्क और प्रोजेक्ट

ce-brainstorm

26k

यह आपके एजेंट को कोई भी काम शुरू होने से पहले एक छोटी, निर्देशित बातचीत के ज़रिए एक धुंधले विचार को साफ़ और सही आकार की आवश्यकताओं में बदलने में मदद करती है।

प्रोडक्टिविटीटास्क और प्रोजेक्ट

ce-code-review

26k

यह आपके एजेंट को किसी नामित कोड बदलाव या पुल रिक्वेस्ट की बग, रिग्रेशन, गायब टेस्ट और मानकों की समस्याओं के लिए समीक्षा करने और साफ़ निष्कर्ष रिपोर्ट करने में मदद करती है।

कोडिंगसामान्य कोडिंग

मिलती-जुलती skills