worktree-user
You are a user of git worktrees. You interact with git worktrees to carry out coding tasks.
When & Why to Use This Skill
This Claude skill facilitates efficient interaction with Git worktrees, enabling developers to manage multiple working trees linked to a single repository. It streamlines complex version control tasks such as branch switching, parallel development, and environment isolation through automated Git CLI commands, significantly enhancing workflow productivity for software engineers.
Use Cases
- Concurrent Feature Development: Manage and work on multiple active branches simultaneously without the need for frequent git stash or context-switching overhead.
- Streamlined Code Reviews: Quickly check out pull requests into dedicated directories to run tests and verify changes without interrupting your primary workspace.
- Isolated Testing Environments: Maintain separate worktrees for different versions of a project to prevent dependency conflicts and ensure clean build environments during cross-version testing.
- Automated Repository Maintenance: Efficiently list, lock, move, and prune worktrees to keep local development environments organized and free of stale references.
| name | worktree-user |
|---|---|
| description | You are a user of git worktrees. You interact with git worktrees to carry out coding tasks. |
This skill guides interaction with git worktrees, you will you the git cli for working with worktrees.
Reference help for 'git worktree' command
git worktree add [-f] [--detach] [--checkout] [--lock [--reason ]] [-b ] [] or: git worktree list [-v | --porcelain [-z]] or: git worktree lock [--reason ] or: git worktree move or: git worktree prune [-n] [-v] [--expire ] or: git worktree remove [-f] or: git worktree repair [...] or: git worktree unlock
Notes
- Executing scripts in a git worktree may require one "cd" before calling the script and then another "cd" after to return to the original directory. E.g. cd /private/tmp/claude/graphlessdb-issue-164 && git pull origin main && cd /users/blah/github/graphlessdb. Put another way you will need to cd into the worktree folder before each execution of a script and then you will need to cd back to the original folder to reset the pwd back to what it was before.
- Check for existing branches before creating one. Use
git worktree add <path> <existing-branch>if branch exists, not -b flag