Agent skill · neolabhq

git-worktrees

Use when working on multiple branches simultaneously, context switching without stashing, reviewing PRs while developing, testing in isolation, or comparing implementations across branches - provides git worktree commands and workflow patterns for parallel development with multiple working directories.

What it needs

About 11k tokens when loaded.

What this skill does

Git Worktrees Overview Git worktrees enable checking out multiple branches simultaneously in separate directories, all sharing the same repository. Create a worktree instead of stashing changes or cloning separately. Core principle: One worktree per active branch. Switch contexts by changing directories, not branches. Core Concepts Concept Description --------- ------------- Main worktree Original working directory from git clone or git init Linked worktree Additional directories created with git worktree add Shared .git All worktrees share same Git object database (no duplication) Branch lock Each branch can only be checked out in ONE worktree at a time Worktree metadata Administrative files in .git/worktrees/ tracking linked worktrees Quick Reference Task Command ------ --------- Create worktree (existing branch) git worktree add <path> <branch> Create worktree (new branch) git worktree add -b <branch> <path> Create worktree (new branch from ref) git worktree add -b <branch> <path> <start> Create detached worktree git worktree add --detach <path> <commit> List all worktrees git worktree list Remove worktree git worktree remove <path> Force remove worktree git worktree remove --force <path> Move worktree git worktree move <old> <new> Lock worktree git worktree lock <path> Unlock worktree git worktree unlock <path> Prune stale worktrees git worktree prune Repair worktree links git worktree repair Compare files between worktrees diff ../worktree-a/file ../worktree-b/file Get one file from another branch git checkout <branch> -- <path> Get partial file changes git checkout -p <branch> -- <path> Cherry-pick a commit git cherry-pick <commit> Cherry-pick without committing git cherry-pick --no-commit <commit> Merge without auto-commit git merge --no-commit <branch> Essential Commands Create a Worktree List Worktrees Example output: Remove a Worktree Move a Worktree Lock/Unlock Worktrees Prune Stale Worktrees Repair Worktrees Workflow Patterns Pattern 1: Feature + Hotfix …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills neolabhq/git-worktrees--0ac413

View the source on GitHub

Browse the @skills marketplace