技能 git-workspace-init
🌿

git-workspace-init

安全 ⚙️ 外部命令📁 文件系统访问

為隔離開發初始化 Git Worktree

並行管理多個分支和功能是一項挑戰。此技能使用傳統的分支命名方式自動建立隔離的 git worktree,實現無需 stash 或切換分支的乾淨並行開發。

支持: Claude Codex Code(CC)
📊 69 充足
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“git-workspace-init”。 /init-workspace feat user-authentication

预期结果:

  • Branch name: feat/user-authentication
  • Creating worktree at: /path/to/project/.worktrees/feat-user-authentication
  • Workspace initialized!
  • Branch: feat/user-authentication
  • Path: /path/to/project/.worktrees/feat-user-authentication
  • To start working: cd /path/to/project/.worktrees/feat-user-authentication

正在使用“git-workspace-init”。 /init-workspace fix login-validation-error

预期结果:

  • Branch name: fix/login-validation-error
  • Creating worktree at: /path/to/project/.worktrees/fix-login-validation-error
  • Workspace initialized!
  • Branch: fix/login-validation-error
  • Path: /path/to/project/.worktrees/fix-login-validation-error
  • To start working: cd /path/to/project/.worktrees/fix-login-validation-error

安全审计

安全
v5 • 1/16/2026

This is a documentation-only skill containing workflow definitions and example code blocks. All subprocess examples use hardcoded command arrays with no user input injection risk. The 'C2 keywords' and 'weak crypto' static findings are false positives triggered by benign words in documentation text. No network calls, no file access beyond user's git repository, no external dependencies.

3
已扫描文件
612
分析行数
2
发现项
5
审计总数

风险因素

审计者: claude 查看审计历史 →

质量评分

38
架构
100
可维护性
85
内容
19
社区
100
安全
91
规范符合性

你能构建什么

並行功能開發

同時處理多個功能,無需 stash 變更或反覆切換分支。

快速錯誤修正隔離

為生產環境熱修復建立隔離的工作空間,不打擾當前的開發狀態。

文件更新

使用專用分支在程式碼變更和文件更新之間保持清晰的分離。

试试这些提示

新功能
/init-workspace feat user-authentication
錯誤修正
/init-workspace fix login-validation-error
文件
/init-workspace docs api-reference
熱修復
/init-workspace hotfix security-patch

最佳实践

  • 使用明確的任務描述清楚表明正在進行的工作
  • 選擇適當的任務類型(feat、fix、hotfix 等)以進行正確的分支分類
  • 合併 PR 後使用提供的清理命令清理 worktree

避免

  • 在分支描述中使用空格或大寫字母會破壞命名慣例
  • 建立 worktree 而不推送到遠端會失去分支追蹤的好處
  • 讓未使用的 worktree 在 .worktrees 目錄中累積

常见问题

什麼是 git worktree?
Git worktree 讓您可以在不同的目錄中同時 checkout 多個分支,無需 stash 變更。
Worktree 建立在哪裡?
Worktree 會在您儲存庫根目錄的 .worktrees 資料夾中建立,以保持有組織的儲存。
我可以將其與任何 git 托管服務一起使用嗎?
是的,它適用於 GitHub、GitLab、Bitbucket 或任何接受標準 git push 操作的 git 遠端。
我的資料安全嗎?
此技能僅在您現有的 git 儲存庫中運作。不存取外部資料或向第三方發送網路呼叫。
如果分支已經存在怎麼辦?
技能會報告錯誤。選擇更具體的描述或檢查是否已經有工作正在進行中。
這與 git checkout -b 有什麼不同?
Git worktree 為並行工作建立隔離的目錄,而 checkout -b 則會切換您目前的目錄上下文。

开发者详情

文件结构