git-worktrees
3
总安装量
3
周安装量
#59605
全站排名
安装命令
npx skills add https://github.com/lexler/skill-factory --skill git-worktrees
Agent 安装分布
opencode
3
gemini-cli
3
antigravity
3
junie
3
claude-code
3
github-copilot
3
Skill 文档
Git Worktrees
Directory Convention
Worktrees live in a sibling directory named <project>_worktrees:
parent/
âââ myproject/ # main repo
âââ myproject_worktrees/ # worktrees directory
âââ feature_1/
âââ feature_2/
Branch Naming
Use <feature>_<N> pattern when creating multiple worktrees:
auth-refactor_1,auth-refactor_2api-migration_1,api-migration_2
Workflow
- Get project name from current directory
- Create worktrees directory if needed:
../<project>_worktrees/ - Create worktree with new branch:
git worktree add <path> -b <branch>
Creating Multiple Worktrees
When asked for N worktrees for a feature:
PROJECT=$(basename "$PWD")
WORKTREES_DIR="../${PROJECT}_worktrees"
mkdir -p "$WORKTREES_DIR"
for i in $(seq 1 N); do
git worktree add "${WORKTREES_DIR}/<feature>_${i}" -b "<feature>_${i}"
done
Cleanup
Remove worktree and branch:
git worktree remove <path>
git branch -d <branch>
List all worktrees: git worktree list