← 教程列表
coding

Detect state, not platform

📅 2026/6/12 16:30:02⏱ 约 5 分钟阅读👁 7 阅读

Use `GIT_DIR != GIT_COMMON` to determine "am I already in a worktree?" rather than sniffing environment variables to identify the harness. This is a stable git primitive (since git 2.5, 2015), works universally across all harnesses, and requires zero maintenance as new harnesses appear.

← 返回教程列表 AI8899 · 内容仅供学习参考