using-git-worktrees
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
- License 许可
- MIT
- 最近更新
- 2026-03-19
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- using-git-worktrees
- description
- Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
02 资源文件 2
- 参考文档BARE-REPOS.md8.7 KB
- 参考文档NON-BARE-REPOS.md8.8 KB
03 SKILL.md 正文
Using Git Worktrees
Overview
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
Core principle: Systematic directory selection + safety verification = reliable isolation.
1. Check for Bare Repository (First Priority)
# Check if we're in a worktree of a bare repo and capture absolute path
common_dir=$(git rev-parse --git-common-dir 2>/dev/null) || {
echo "ERROR: Failed to get git-common-dir: are you in a git repo?"
exit 1
}
if [ -n "$common_dir" ] && grep -q "bare = true" "$common_dir/config" 2>/dev/null; then
echo "BARE REPO DETECTED"
echo "BARE_ROOT: $common_dir"
else
echo "NON-BARE REPO DETECTED"
fi
If failed to get git-common-dir:
- This skill only applies to git repos. Inform user and abort this skill.
If bare repo detected:
- Keep track of
BARE_ROOTfor later use - Proceed to BARE-REPOS.md and follow the instructions there
If non-bare repo detected:
- Proceed to NON-BARE-REPOS.md and follow the instructions there
04 同仓库更多 Skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
writing good code
use this skill whenever you write code. it provides a process for creating good, composable apis.
write-review-elixir
Review Elixir code. ALWAYS use this skill before or after you added code written in elixir to ensure high code quality. Also use use this when asked to review existing elixir code.
whats-next
Answers what to do next, what to work on next, where we're at
verification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always