Uses Git worktrees to create isolated working directories attached to the same repository, each on a different branch, so parallel experiments or long-running tasks do not interfere with the main working tree or require repeated stash-and-reapply cycles. This is especially useful when one branch requires a heavy build or test run while work continues on another.
Use cases
- Working on a feature branch that requires a 20-minute build while simultaneously starting work on a new feature branch
- Running CI-heavy tests on one branch while reviewing or merging code on another branch in the same repo
- Comparing the behavior of two branches side-by-side without switching contexts and losing uncommitted work
- Rebasing or interactive editing a long-running branch while keeping the main branch clean and deployable
- Reviewing a colleague's branch locally without disturbing your own uncommitted work
Key features
- Create a dedicated worktree for each branch using git worktree add, specifying a unique directory path outside the main repo folder
- Do heavy edits, builds, or test runs in the isolated worktree without affecting the main working tree
- Periodically rebase the worktree branch onto the main branch to catch integration conflicts early rather than at merge time
- When the worktree branch is merged, delete the worktree and prune the branch reference to keep the repository clean
- Use git worktree list to track all active worktrees and their associated branches
When to Use This Skill
- When a branch requires a long build or test run that would block other work
- When needing to work on two branches simultaneously without stashing uncommitted changes
- When reviewing or testing a colleague's branch locally while preserving your current working state
Expected Output
Isolated worktree directories, each on a named branch, with a clean lifecycle from creation to deletion after merge.
Frequently Asked Questions
- What are the limits of how many worktrees I can create?
- Git worktrees share the same object database, so disk usage is minimal, but each worktree must be on a unique branch. You cannot create a worktree for a branch that already has an existing worktree or the main checkout.
- Can I push to remote from a worktree?
- Yes, git push from a worktree behaves normally. The remote sees the branch normally regardless of which worktree it is pushed from.
- What happens to my worktree if I force-push or delete the branch it is on?
- The worktree directory remains but the branch reference becomes orphaned. You will see a warning when entering the directory. Either recreate the branch or delete the orphaned worktree with git worktree prune.
Related
Related
3 Indexed items
Finishing a development branch
Systematically closes out a development branch by running verification, cleaning up the commit history, pushing with proper tracking, and making an explicit choice between merge, squash, or follow-up tickets. This prevents the common pattern of abandoned branches, stale PRs, and lost context when work is not deliberately concluded.
SEO audit for web properties
Diagnoses indexing, crawlability, and on-page SEO issues across an entire site using automated crawls, Lighthouse checks, and structured output. An SEO audit surfaces actionable findings ranked by priority before manual review, making it possible to address critical issues quickly rather than discovering them through traffic drops.
Example SLO document authoring
Operationalizes Appendix A from Google’s SRE workbook by translating the illustrative “Example Game Service” SLO dossier into a checklist teams can mimic: articulate the user-facing workload, nominate rolling measurement windows (the appendix uses four weeks), pair each subsystem with tightly defined SLIs (availability from load balancers excluding 5xx, latency percentile gates, freshness for derived tables, correctness via probers, completeness for pipelines), cite explicit numerator/denominator language, rationalize rounding policies, quantify per-objective error budgets, and cite the sibling error budget policy for enforcement.