andreaswasita/copilot-agents-dojo/using-git-worktrees
Claude Code and agent skill by andreaswasita/copilot-agents-dojo
- community
Checking that the SKILL.md file is still in the repository.
Isolates each task in its own git worktree off main.
Install
npx vskill@latest install andreaswasita/copilot-agents-dojo/using-git-worktreesSKILL.md
Using Git Worktrees Skill
Creates an isolated git worktree on a dedicated feature branch for every development task, so main is never touched until finishing-a-development-branch says so. Does NOT replace feature branches when worktrees are impractical (CI, single-file fix) — the isolation principle is what matters.
When to Use
- Starting any non-trivial development task (default behavior).
- Before the agent would otherwise modify code on
main. - When parallel development tracks are needed (multiple worktrees in flight).
- After
brainstormingproduces an approved design. - NOT for a one-line typo fix where a branch is sufficient.
Prerequisites
git≥ 2.5 with worktree support.- The repository is already cloned (a worktree extends an existing clone).
- The
powershellCopilot tool to rungit. - A naming convention agreed for the branch:
feature/*,fix/*,experiment/*. - The project's dependency install command (
npm install,pip install -r requirements.txt, etc.).
How to Run
Quick Reference
| Operation | Command | |
|---|---|---|
| Create | git worktree add ../<dirname> -b <branch> | |
| List | git worktree list | |
| Remove | git worktree remove ../<dirname> | |
| Prune stale | git worktree prune |
| Branch prefix | Use | |
|---|---|---|
feature/<slug> | New features | |
fix/<slug> | Bug fixes | |
experiment/<slug> | Spikes / throwaway |
| Dependency bootstrap | Detect signal | |
|---|---|---|
npm install | package.json | |
pip install -r requirements.txt | requirements.txt | |
go mod download | go.mod | |
mvn dependency:resolve | pom.xml | |
dotnet restore | *.csproj |
Procedure
Step 1: Create the Worktree
From the main repo root, run via the powershell tool:
Use a directory name that is obviously not the main repo so you cannot edit the wrong one by accident.
Step 2: Install Dependencies
Detect the stack from the table above and run the matching install command. A worktree shares .git, not node_modules / .venv / build artifacts.
Step 3: Establish a Green Baseline
Run the project's test command via the powershell tool. Capture pass/fail counts before changing any code. If the baseline is red, fix it first or explicitly acknowledge the broken tests in tasks/todo.md.
Step 4: Work Inside the Worktree
All commits go to the feature branch. The main repo's working tree is read-only for the duration. Open files and run commands only from inside the worktree directory.
Step 5: When Worktrees Are Impractical
For CI environments, single-file fixes, or systems without worktree support:
The isolation principle still applies: never commit to main.
Step 6: Cleanup (handled later)
Worktree teardown is owned by finishing-a-development-branch. Do not remove the worktree mid-task.
Pitfalls
- DO NOT commit to
main. Not even once. That is how production breaks. - DO NOT reuse a stale worktree from a prior task. Create a fresh one.
- DO NOT skip the baseline test run. Unknown baseline = unverifiable changes.
- DO NOT leave orphaned worktrees behind.
git worktree listto audit; cleanup belongs to the finishing skill. - DO NOT edit files across multiple worktrees in one task. One worktree, one task.
Verification
- [ ]
git worktree listshows the new worktree. - [ ] Current directory matches the worktree path; current branch is the new feature branch.
- [ ] Dependencies installed inside the worktree.
- [ ] Test baseline captured (counts recorded in
tasks/todo.md). - [ ]
git status --porcelainwas empty before the first code change.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/using-git-worktrees/SKILL.md
Popularity
- Repository stars
- 32
- Repository forks
- 12
- 7-day trend score
- 17
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 27 Apr 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/andreaswasita/copilot-agents-dojo/using-git-worktrees)