news
Environment Detection
Skills that create worktrees or finish branches should detect their environment with read-only git commands before proceeding: ```bash GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P) GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P) BRANCH=$(git branch --show-current) ``` - `GIT_DIR != GIT_COMMON` → already in a linked worktree (skip creation) - `BRANCH` empty → detached HEAD (cannot branch/push/PR from sandbox) See `using-git-worktrees` Step 0 and `finishing-a-development-branch` Step 1.5 for how each skill uses these signals.
← 返回教程列表
AI8899 · 内容仅供学习参考