create-git-worktree
Create isolated git worktree environments
Managing multiple branches in the same repository can lead to context switching issues and workspace clutter. This skill automates the creation of isolated git worktrees in a dedicated directory, copying environment files and setting up clean workspaces for each feature branch.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "create-git-worktree". Create a git worktree for branch feature/add-user-login
Expected outcome:
- ✓ Worktree created successfully!
- Location: /path/to/project-worktrees/feature-add-user-login
- Next steps:
- 1. cd /path/to/project-worktrees/feature-add-user-login
- 2. Start working on your task
Using "create-git-worktree". Create a git worktree for bugfix/login-issue --from main
Expected outcome:
- Creating worktree for branch: bugfix/login-issue
- Base branch: main
- Worktree path: /path/to/project-worktrees/bugfix-login-issue
- ✓ Worktree created successfully!
- Next steps:
- 1. cd /path/to/project-worktrees/bugfix-login-issue
- 2. Start working on your task
Security Audit
Low RiskBenign git worktree automation script. Creates isolated development environments using standard git commands. Copies .env for local development setup, which is documented expected behavior. No network calls, no credential exfiltration patterns, no obfuscation detected. All static findings are false positives from legitimate git automation patterns.
Risk Factors
⚡ Contains scripts (1)
⚙️ External commands (1)
📁 Filesystem access (1)
Quality Score
What You Can Build
Isolated feature development
Create clean, isolated workspaces for working on feature branches without affecting your main development directory.
Review PR branches locally
Quickly check out pull request branches in isolated worktrees to test changes before merging.
Parallel experiment workspaces
Run multiple experiments or fixes simultaneously in separate worktrees for clean comparison.
Try These Prompts
Create a git worktree for branch feature/my-new-feature
Create a git worktree for branch hotfix/security-fix --from develop
Create a git worktree for branch feature/api/user-authentication
I've finished my current task. Now create a worktree for bugfix/login-issue
Best Practices
- Use meaningful branch names that clearly describe the work being done
- Delete worktrees after merging to keep the worktrees directory organized
- Keep .env files updated in the main repository for consistent environment setup
Avoid
- Creating worktrees for branches that already exist locally without checking
- Running the script from inside a worktree directory instead of the main repo
- Modifying files in multiple worktrees that share the same .env without understanding implications
Frequently Asked Questions
What git versions support worktree?
How many worktrees can I create?
Does this work with GitHub CLI or other git tools?
Is my .env file data safe?
What if the worktree creation fails?
How does this differ from cloning the repository?
Developer Details
Author
AKABANAKKLicense
MIT
Repository
https://github.com/AKABANAKK/claude-code-marketplace/tree/main/akb7/skills/create-git-worktreeRef
main
File structure