zcf 2.10.1 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -24
- package/bin/zcf.mjs +1 -1
- package/dist/chunks/simple-config.mjs +948 -896
- package/dist/cli.mjs +319 -256
- package/dist/index.d.mts +13 -13
- package/dist/index.d.ts +13 -13
- package/dist/index.mjs +3 -4
- package/package.json +20 -15
- package/templates/CLAUDE.md +249 -5
- package/templates/common/CLAUDE.md +5 -0
- package/templates/en/memory/mcp.md +4 -1
- package/templates/en/memory/personality.md +1 -1
- package/templates/en/memory/rules.md +1 -4
- package/templates/en/workflow/bmad/commands/bmad-init.md +58 -56
- package/templates/en/workflow/common/agents/get-current-datetime.md +29 -0
- package/templates/en/workflow/common/agents/init-architect.md +114 -0
- package/templates/en/workflow/common/commands/init-project.md +53 -0
- package/templates/en/workflow/git/commands/git-cleanBranches.md +2 -1
- package/templates/en/workflow/git/commands/git-commit.md +36 -31
- package/templates/en/workflow/git/commands/git-rollback.md +27 -26
- package/templates/en/workflow/git/commands/git-worktree.md +145 -221
- package/templates/zh-CN/memory/mcp.md +4 -1
- package/templates/zh-CN/memory/personality.md +1 -1
- package/templates/zh-CN/memory/rules.md +1 -4
- package/templates/zh-CN/workflow/bmad/commands/bmad-init.md +58 -55
- package/templates/zh-CN/workflow/common/agents/get-current-datetime.md +29 -0
- package/templates/zh-CN/workflow/common/agents/init-architect.md +114 -0
- package/templates/zh-CN/workflow/common/commands/init-project.md +53 -0
- package/templates/zh-CN/workflow/git/commands/git-cleanBranches.md +2 -1
- package/templates/zh-CN/workflow/git/commands/git-commit.md +0 -5
- package/templates/zh-CN/workflow/git/commands/git-rollback.md +1 -1
- package/templates/zh-CN/workflow/git/commands/git-worktree.md +145 -221
- /package/templates/{settings.json → common/settings.json} +0 -0
|
@@ -1,301 +1,225 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: 管理 Git worktree
|
|
3
|
-
allowed-tools: Read(**), Exec(git worktree add, git worktree list, git worktree remove, git worktree prune, git branch, git checkout, git rev-parse, git stash, git cp,
|
|
2
|
+
description: 管理 Git worktree,在项目平级的 ../.zcf/项目名/ 目录下创建,支持智能默认、IDE 集成和内容迁移
|
|
3
|
+
allowed-tools: Read(**), Exec(git worktree add, git worktree list, git worktree remove, git worktree prune, git branch, git checkout, git rev-parse, git stash, git cp, detect-ide, open-ide, which, command, basename, dirname)
|
|
4
4
|
argument-hint: <add|list|remove|prune|migrate> [path] [-b <branch>] [-o|--open] [--track] [--guess-remote] [--detach] [--checkout] [--lock] [--migrate-from <source-path>] [--migrate-stash]
|
|
5
5
|
# examples:
|
|
6
|
-
# - /git-worktree add feature-ui #
|
|
6
|
+
# - /git-worktree add feature-ui # 从 main/master 创建新分支 'feature-ui'
|
|
7
7
|
# - /git-worktree add feature-ui -o # 创建 worktree 并直接用 IDE 打开
|
|
8
|
-
# - /git-worktree add hotfix -b fix/login -o #
|
|
9
|
-
# - /git-worktree migrate feature-ui --from main #
|
|
10
|
-
# - /git-worktree migrate feature-ui --stash # 将当前 stash
|
|
8
|
+
# - /git-worktree add hotfix -b fix/login -o # 创建新分支 'fix/login',路径为 'hotfix'
|
|
9
|
+
# - /git-worktree migrate feature-ui --from main # 将主分支未提交内容迁移到 feature-ui
|
|
10
|
+
# - /git-worktree migrate feature-ui --stash # 将当前 stash 迁移到 feature-ui
|
|
11
11
|
---
|
|
12
12
|
|
|
13
13
|
# Claude Command: Git Worktree
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
管理 Git worktree,支持智能默认、IDE 集成和内容迁移,使用结构化的 `../.zcf/项目名/` 路径。
|
|
16
|
+
|
|
17
|
+
直接执行命令并提供简洁结果。
|
|
16
18
|
|
|
17
19
|
---
|
|
18
20
|
|
|
19
21
|
## Usage
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
|
-
#
|
|
23
|
-
/git-worktree add <path> #
|
|
24
|
-
/git-worktree add <path> -b <branch> #
|
|
25
|
-
/git-worktree add <path> -o #
|
|
26
|
-
/git-worktree add <path> -b <branch> --open # 创建新分支、worktree 并直接打开
|
|
27
|
-
|
|
28
|
-
# 内容迁移
|
|
29
|
-
/git-worktree migrate <target-path> --from <source-path> # 迁移未提交内容
|
|
30
|
-
/git-worktree migrate <target-path> --stash # 迁移 stash 内容
|
|
31
|
-
|
|
32
|
-
# 其他操作
|
|
24
|
+
# 基本操作
|
|
25
|
+
/git-worktree add <path> # 从 main/master 创建名为 <path> 的新分支
|
|
26
|
+
/git-worktree add <path> -b <branch> # 创建指定名称的新分支
|
|
27
|
+
/git-worktree add <path> -o # 创建并直接用 IDE 打开
|
|
33
28
|
/git-worktree list # 显示所有 worktree 状态
|
|
34
29
|
/git-worktree remove <path> # 删除指定的 worktree
|
|
35
30
|
/git-worktree prune # 清理无效 worktree 记录
|
|
31
|
+
|
|
32
|
+
# 内容迁移
|
|
33
|
+
/git-worktree migrate <target> --from <source> # 迁移未提交内容
|
|
34
|
+
/git-worktree migrate <target> --stash # 迁移 stash 内容
|
|
36
35
|
```
|
|
37
36
|
|
|
38
37
|
### Options
|
|
39
38
|
|
|
40
|
-
| 选项
|
|
41
|
-
|
|
42
|
-
| `add <path
|
|
43
|
-
| `migrate <target>` | 迁移内容到指定 worktree
|
|
44
|
-
| `list`
|
|
45
|
-
| `remove <path>`
|
|
46
|
-
| `prune`
|
|
47
|
-
| `-b <branch>`
|
|
48
|
-
| `-o, --open`
|
|
49
|
-
| `--from <source>`
|
|
50
|
-
| `--stash`
|
|
51
|
-
| `--track`
|
|
52
|
-
| `--guess-remote`
|
|
53
|
-
| `--detach`
|
|
54
|
-
| `--checkout` |
|
|
55
|
-
| `--lock`
|
|
39
|
+
| 选项 | 说明 |
|
|
40
|
+
| ------------------ | -------------------------------------------- |
|
|
41
|
+
| `add [<path>]` | 在 `../.zcf/项目名/<path>` 添加新的 worktree |
|
|
42
|
+
| `migrate <target>` | 迁移内容到指定 worktree |
|
|
43
|
+
| `list` | 列出所有 worktree 及其状态 |
|
|
44
|
+
| `remove <path>` | 删除指定路径的 worktree |
|
|
45
|
+
| `prune` | 清理无效的 worktree 引用 |
|
|
46
|
+
| `-b <branch>` | 创建新分支并检出到 worktree |
|
|
47
|
+
| `-o, --open` | 创建成功后直接用 IDE 打开(跳过询问) |
|
|
48
|
+
| `--from <source>` | 指定迁移源路径(migrate 专用) |
|
|
49
|
+
| `--stash` | 迁移当前 stash 内容(migrate 专用) |
|
|
50
|
+
| `--track` | 设置新分支跟踪对应的远程分支 |
|
|
51
|
+
| `--guess-remote` | 自动猜测远程分支进行跟踪 |
|
|
52
|
+
| `--detach` | 创建分离 HEAD 的 worktree |
|
|
53
|
+
| `--checkout` | 创建后立即检出(默认行为) |
|
|
54
|
+
| `--lock` | 创建后锁定 worktree |
|
|
56
55
|
|
|
57
56
|
---
|
|
58
57
|
|
|
59
58
|
## What This Command Does
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
- 通过 `git rev-parse --is-inside-work-tree`
|
|
60
|
+
1. **环境检查**
|
|
61
|
+
- 通过 `git rev-parse --is-inside-work-tree` 验证 Git 仓库
|
|
62
|
+
- 检测是否在主仓库或现有 worktree 中,进行智能路径计算
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
64
|
+
2. **智能路径管理**
|
|
65
|
+
- 使用 worktree 检测自动从主仓库路径计算项目名
|
|
66
|
+
- 在结构化的 `../.zcf/项目名/<path>` 目录创建 worktree
|
|
67
|
+
- 正确处理主仓库和 worktree 执行上下文
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
```bash
|
|
70
|
+
# worktree 检测的核心路径计算逻辑
|
|
71
|
+
get_main_repo_path() {
|
|
72
|
+
local git_common_dir=$(git rev-parse --git-common-dir 2>/dev/null)
|
|
73
|
+
local current_toplevel=$(git rev-parse --show-toplevel 2>/dev/null)
|
|
74
|
+
|
|
75
|
+
# 检测是否在 worktree 中
|
|
76
|
+
if [[ "$git_common_dir" != "$current_toplevel/.git" ]]; then
|
|
77
|
+
# 在 worktree 中,从 git-common-dir 推导主仓库路径
|
|
78
|
+
dirname "$git_common_dir"
|
|
79
|
+
else
|
|
80
|
+
# 在主仓库中
|
|
81
|
+
echo "$current_toplevel"
|
|
82
|
+
fi
|
|
83
|
+
}
|
|
73
84
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- **IDE 检测**:自动检测常用 IDE(VS Code、Cursor、WebStorm 等)
|
|
78
|
-
- **智能选择**:基于项目类型和已安装的 IDE 推荐最佳选择
|
|
85
|
+
MAIN_REPO_PATH=$(get_main_repo_path)
|
|
86
|
+
PROJECT_NAME=$(basename "$MAIN_REPO_PATH")
|
|
87
|
+
WORKTREE_BASE="$MAIN_REPO_PATH/../.zcf/$PROJECT_NAME"
|
|
79
88
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
- **安全检查**:迁移前检查目标 worktree 状态,避免冲突
|
|
89
|
+
# 始终使用绝对路径防止嵌套问题
|
|
90
|
+
ABSOLUTE_WORKTREE_PATH="$WORKTREE_BASE/<path>"
|
|
91
|
+
```
|
|
84
92
|
|
|
85
|
-
|
|
86
|
-
- 所有相对路径自动添加 `.zcf/` 前缀
|
|
87
|
-
- 绝对路径保持原样
|
|
88
|
-
- 自动创建 `.zcf/` 目录(如果不存在)
|
|
93
|
+
**关键修复**: 在现有 worktree 内创建新 worktree 时,始终使用绝对路径以防止出现类似 `../.zcf/project/.zcf/project/path` 的路径嵌套问题。
|
|
89
94
|
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
95
|
+
3. **Worktree 操作**
|
|
96
|
+
- **add**: 使用智能分支/路径默认创建新 worktree
|
|
97
|
+
- **list**: 显示所有 worktree 的分支和状态
|
|
98
|
+
- **remove**: 安全删除 worktree 并清理引用
|
|
99
|
+
- **prune**: 清理孤立的 worktree 记录
|
|
94
100
|
|
|
95
|
-
|
|
101
|
+
4. **智能默认**
|
|
102
|
+
- **分支创建**: 未指定 `-b` 时,使用路径名创建新分支
|
|
103
|
+
- **基础分支**: 新分支从 main/master 分支创建
|
|
104
|
+
- **路径解析**: 未指定路径时使用分支名作为路径
|
|
105
|
+
- **IDE 集成**: 自动检测并提示 IDE 打开
|
|
96
106
|
|
|
97
|
-
|
|
107
|
+
5. **内容迁移**
|
|
108
|
+
- 在 worktree 之间迁移未提交改动
|
|
109
|
+
- 将 stash 内容应用到目标 worktree
|
|
110
|
+
- 安全检查防止冲突
|
|
98
111
|
|
|
99
|
-
|
|
112
|
+
6. **安全特性**
|
|
113
|
+
- **路径冲突防护**: 创建前检查目录是否已存在
|
|
114
|
+
- **分支检出验证**: 确保分支未被其他地方使用
|
|
115
|
+
- **绝对路径强制**: 防止在 worktree 内创建嵌套的 `.zcf` 目录
|
|
116
|
+
- **删除时自动清理**: 同时清理目录和 git 引用
|
|
117
|
+
- **清晰的状态报告**: 显示 worktree 位置和分支状态
|
|
100
118
|
|
|
101
|
-
|
|
102
|
-
- **VS Code**: `code <path>`
|
|
103
|
-
- **Cursor**: `cursor <path>`
|
|
104
|
-
- **WebStorm**: `webstorm <path>`
|
|
105
|
-
- **其他**: 可配置自定义 IDE 命令
|
|
119
|
+
---
|
|
106
120
|
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
# 默认:创建后询问是否打开
|
|
110
|
-
/git-worktree add feature-ui
|
|
111
|
-
# 输出:🖥️ 是否在 IDE 中打开 .zcf/feature-ui?[y/n]:
|
|
121
|
+
## Enhanced Features
|
|
112
122
|
|
|
113
|
-
|
|
114
|
-
/git-worktree add feature-ui -o
|
|
115
|
-
# 输出:🚀 正在用 VS Code 打开 .zcf/feature-ui...
|
|
116
|
-
```
|
|
123
|
+
### IDE 集成
|
|
117
124
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
4. 记住用户偏好供下次使用
|
|
125
|
+
- **自动检测**: VS Code → Cursor → WebStorm → Sublime Text → Vim
|
|
126
|
+
- **智能提示**: 创建 worktree 后询问是否在 IDE 中打开
|
|
127
|
+
- **直接打开**: 使用 `-o` 标志跳过提示直接打开
|
|
128
|
+
- **自定义配置**: 通过 git config 配置
|
|
123
129
|
|
|
124
|
-
###
|
|
130
|
+
### 内容迁移系统
|
|
125
131
|
|
|
126
|
-
**迁移类型**
|
|
127
132
|
```bash
|
|
128
|
-
#
|
|
133
|
+
# 迁移未提交改动
|
|
129
134
|
/git-worktree migrate feature-ui --from main
|
|
135
|
+
/git-worktree migrate hotfix --from ../other-worktree
|
|
130
136
|
|
|
131
|
-
#
|
|
132
|
-
/git-worktree migrate hotfix --from .zcf/feature-ui
|
|
133
|
-
|
|
134
|
-
# 迁移当前 stash
|
|
137
|
+
# 迁移 stash 内容
|
|
135
138
|
/git-worktree migrate feature-ui --stash
|
|
136
|
-
|
|
137
|
-
# 迁移指定 stash
|
|
138
|
-
/git-worktree migrate feature-ui --stash stash@{2}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
1. **源检查**:验证源路径存在且有未提交内容
|
|
143
|
-
2. **目标检查**:确保目标 worktree 工作区干净
|
|
144
|
-
3. **内容分析**:显示即将迁移的文件和改动
|
|
145
|
-
4. **安全迁移**:使用 git 原生命令确保数据安全
|
|
146
|
-
5. **结果确认**:显示迁移结果和后续建议
|
|
141
|
+
**迁移流程**:
|
|
147
142
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
- **分支冲突检查**:避免同一分支被多个 worktree 检出
|
|
154
|
-
- **自动清理**:remove 操作会同时清理目录和 git 引用
|
|
155
|
-
- **状态显示**:清晰显示每个 worktree 的分支、提交和状态
|
|
156
|
-
|
|
157
|
-
### **迁移安全保护**
|
|
158
|
-
- **冲突检测**:迁移前检查是否会产生文件冲突
|
|
159
|
-
- **备份机制**:迁移前自动创建 stash 备份
|
|
160
|
-
- **回滚支持**:提供迁移失败时的回滚方案
|
|
161
|
-
- **状态验证**:确保源和目标 worktree 处于正确状态
|
|
162
|
-
|
|
163
|
-
### **IDE 集成安全**
|
|
164
|
-
- **路径验证**:确保 IDE 命令使用正确的路径
|
|
165
|
-
- **权限检查**:验证 IDE 可执行文件的权限
|
|
166
|
-
- **错误处理**:IDE 启动失败时的友好错误提示
|
|
143
|
+
1. 验证源有未提交内容
|
|
144
|
+
2. 确保目标 worktree 干净
|
|
145
|
+
3. 显示即将迁移的改动
|
|
146
|
+
4. 使用 git 命令安全迁移
|
|
147
|
+
5. 确认结果并建议后续步骤
|
|
167
148
|
|
|
168
149
|
---
|
|
169
150
|
|
|
170
151
|
## Examples
|
|
171
152
|
|
|
172
|
-
### **基础使用 + IDE 打开**
|
|
173
153
|
```bash
|
|
174
|
-
#
|
|
175
|
-
/git-worktree add feature-ui
|
|
176
|
-
#
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
#
|
|
180
|
-
#
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
#
|
|
185
|
-
/git-worktree
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
# 🚀 正在用 VS Code 打开 .zcf/feature-ui...
|
|
189
|
-
|
|
190
|
-
# 创建新分支并直接打开
|
|
191
|
-
/git-worktree add hotfix -b fix/login --open
|
|
192
|
-
# 输出:
|
|
193
|
-
# ✅ Created branch 'fix/login' and worktree at .zcf/hotfix
|
|
194
|
-
# 🚀 正在用 VS Code 打开 .zcf/hotfix...
|
|
154
|
+
# 基本用法
|
|
155
|
+
/git-worktree add feature-ui # 从 main/master 创建新分支 'feature-ui'
|
|
156
|
+
/git-worktree add feature-ui -b my-feature # 创建新分支 'my-feature',路径为 'feature-ui'
|
|
157
|
+
/git-worktree add feature-ui -o # 创建并直接用 IDE 打开
|
|
158
|
+
|
|
159
|
+
# 内容迁移场景
|
|
160
|
+
/git-worktree add feature-ui -b feature/new-ui # 创建新功能 worktree
|
|
161
|
+
/git-worktree migrate feature-ui --from main # 迁移未提交改动
|
|
162
|
+
/git-worktree migrate hotfix --stash # 迁移 stash 内容
|
|
163
|
+
|
|
164
|
+
# 管理操作
|
|
165
|
+
/git-worktree list # 查看所有 worktree
|
|
166
|
+
/git-worktree remove feature-ui # 删除不需要的 worktree
|
|
167
|
+
/git-worktree prune # 清理无效引用
|
|
195
168
|
```
|
|
196
169
|
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
# 场景:在 main 分支开发了一些功能,想移到新分支
|
|
200
|
-
# 1. 创建新的 feature worktree
|
|
201
|
-
/git-worktree add feature-ui -b feature/new-ui
|
|
202
|
-
|
|
203
|
-
# 2. 将 main 的未提交内容迁移过去
|
|
204
|
-
/git-worktree migrate feature-ui --from main
|
|
205
|
-
# 输出:
|
|
206
|
-
# 📦 发现以下未提交内容:
|
|
207
|
-
# M src/components/Button.tsx
|
|
208
|
-
# A src/components/Modal.tsx
|
|
209
|
-
# ?? src/styles/new-theme.css
|
|
210
|
-
# 🔄 迁移到 .zcf/feature-ui...
|
|
211
|
-
# ✅ 迁移完成!建议在新 worktree 中提交这些改动。
|
|
212
|
-
|
|
213
|
-
# 3. 询问是否打开 IDE(因为创建时没有使用 -o)
|
|
214
|
-
# 🖥️ 是否在 IDE 中打开 .zcf/feature-ui?[y/n]: y
|
|
215
|
-
```
|
|
170
|
+
**示例输出**:
|
|
216
171
|
|
|
217
|
-
### **Stash 迁移**
|
|
218
|
-
```bash
|
|
219
|
-
# 当前有一些 stash,想应用到特定 worktree
|
|
220
|
-
/git-worktree migrate hotfix --stash
|
|
221
|
-
# 输出:
|
|
222
|
-
# 📋 发现以下 stash:
|
|
223
|
-
# stash@{0}: WIP on main: fix user login
|
|
224
|
-
# stash@{1}: WIP on main: update docs
|
|
225
|
-
# 选择要迁移的 stash [0/1]: 0
|
|
226
|
-
# 🔄 正在将 stash@{0} 应用到 .zcf/hotfix...
|
|
227
|
-
# ✅ Stash 内容已成功应用!
|
|
228
172
|
```
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
# 查看所有 worktree
|
|
233
|
-
/git-worktree list
|
|
234
|
-
# 输出:
|
|
235
|
-
# /path/to/project [main] ← 主工作树
|
|
236
|
-
# /path/to/project/.zcf/feature-ui [feature/new-ui]
|
|
237
|
-
# /path/to/project/.zcf/hotfix [fix/login]
|
|
238
|
-
|
|
239
|
-
# 删除不需要的 worktree
|
|
240
|
-
/git-worktree remove feature-ui
|
|
241
|
-
# 输出:
|
|
242
|
-
# ✅ Worktree .zcf/feature-ui removed successfully
|
|
243
|
-
|
|
244
|
-
# 清理无效引用
|
|
245
|
-
/git-worktree prune
|
|
246
|
-
# 输出:
|
|
247
|
-
# 🧹 Pruned 0 worktree entries
|
|
173
|
+
✅ Worktree created at ../.zcf/项目名/feature-ui
|
|
174
|
+
🖥️ 是否在 IDE 中打开 ../.zcf/项目名/feature-ui?[y/n]: y
|
|
175
|
+
🚀 正在用 VS Code 打开 ../.zcf/项目名/feature-ui...
|
|
248
176
|
```
|
|
249
177
|
|
|
250
178
|
---
|
|
251
179
|
|
|
252
180
|
## Directory Structure
|
|
253
181
|
|
|
254
|
-
使用此命令后,项目结构会是:
|
|
255
182
|
```
|
|
256
|
-
|
|
257
|
-
├──
|
|
258
|
-
├── .
|
|
259
|
-
│
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
├──
|
|
264
|
-
└──
|
|
183
|
+
parent-directory/
|
|
184
|
+
├── your-project/ # 主项目
|
|
185
|
+
│ ├── .git/
|
|
186
|
+
│ └── src/
|
|
187
|
+
└── .zcf/ # worktree 管理
|
|
188
|
+
└── your-project/ # 项目 worktree
|
|
189
|
+
├── feature-ui/ # 功能分支
|
|
190
|
+
├── hotfix/ # 修复分支
|
|
191
|
+
└── debug/ # 调试 worktree
|
|
265
192
|
```
|
|
266
193
|
|
|
267
194
|
---
|
|
268
195
|
|
|
269
196
|
## Configuration
|
|
270
197
|
|
|
271
|
-
###
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
"defaultWorktreeDir": ".zcf"
|
|
279
|
-
}
|
|
280
|
-
```
|
|
198
|
+
### IDE 配置
|
|
199
|
+
|
|
200
|
+
- 支持 VS Code、Cursor、WebStorm、Sublime Text、Vim
|
|
201
|
+
- 通过 git config 配置自定义 IDE
|
|
202
|
+
- 基于优先级的自动检测选择
|
|
203
|
+
|
|
204
|
+
### 自定义 IDE 设置
|
|
281
205
|
|
|
282
|
-
### **自定义 IDE 命令**
|
|
283
206
|
```bash
|
|
284
|
-
#
|
|
285
|
-
git config worktree.ide.custom "subl %s"
|
|
286
|
-
git config worktree.ide.preferred "
|
|
207
|
+
# 配置自定义 IDE
|
|
208
|
+
git config worktree.ide.custom.sublime "subl %s"
|
|
209
|
+
git config worktree.ide.preferred "sublime"
|
|
210
|
+
|
|
211
|
+
# 控制自动检测
|
|
212
|
+
git config worktree.ide.autodetect true # 默认
|
|
287
213
|
```
|
|
288
214
|
|
|
289
215
|
---
|
|
290
216
|
|
|
291
217
|
## Notes
|
|
292
218
|
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
-
-
|
|
296
|
-
-
|
|
297
|
-
-
|
|
298
|
-
- **IDE 要求**:需要 IDE 的命令行工具已安装并在 PATH 中
|
|
299
|
-
- **跨平台支持**:IDE 检测和启动支持 Windows、macOS、Linux
|
|
219
|
+
- **性能**: worktree 共享 `.git` 目录,节省磁盘空间
|
|
220
|
+
- **安全**: 路径冲突防护和分支检出验证
|
|
221
|
+
- **迁移**: 仅限未提交改动;已提交内容需使用 `git cherry-pick`
|
|
222
|
+
- **IDE 要求**: 命令行工具必须在 PATH 中
|
|
223
|
+
- **跨平台**: 支持 Windows、macOS、Linux
|
|
300
224
|
|
|
301
|
-
---
|
|
225
|
+
---
|
|
File without changes
|