nop-git-worktree

Manages Git bare repositories and parallel worktrees for isolated feature branch development.

693|100|Updated Aug 18, 2022
One-click install
npx skills add https://github.com/entropy-cloud/nop-entropy --skill nop-git-worktree
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nop-git-worktree
Source: https://github.com/entropy-cloud/nop-entropy/tree/main/.opencode/skills/nop-git-worktree
Command: npx skills add https://github.com/entropy-cloud/nop-entropy --skill nop-git-worktree

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Working on multiple branches of the same repository forces constant stashing, switching, and rebuilding. This Skill manages a bare-repository-plus-worktree layout so each feature branch lives in its own directory with its own Maven repository, eliminating branch-switching conflicts.

Core Features & Use Cases

  • Bare + Worktree Initialization: Clone a remote or local repository into a .bare directory and create the main-branch worktree with automatic project and default-branch detection.
  • Feature Worktree Lifecycle: Generate conventional branch names (feat-, fix-, refactor-, hotfix-), create worktrees with isolated Maven local repositories, and safely delete them after checking for uncommitted or unpushed work.
  • Merge Orchestration: Coordinate merging a feature branch back into the main branch via soft reset, recommit, and fast-forward merge, delegating commit/sync/rebase steps to the nop-git-master skill.
  • Use Case: You need to refactor job scheduling while a hotfix is in progress. Create a nop-entropy-refactor-job-scheduling worktree alongside the hotfix worktree, develop both in parallel, then merge each back to master independently.

Quick Start

Initialize a bare-plus-worktree layout for my repository at ~/app/nop-entropy-wt and create a new feature worktree for adding user authentication.

Frequently Asked Questions about nop-git-worktree

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Git worktree from a bare repository?

Clone the repository with git clone --bare into a .bare directory, then run git -C .bare worktree add ../project-branch -b branch-name. Always execute worktree commands from the .bare directory using relative paths.

How do I work on multiple Git branches at the same time?

Use git worktree to check out each branch into its own directory under a shared bare repository. Each worktree gets an independent working tree, so you can build and test branches in parallel without stashing or switching.

How do I safely delete a Git worktree without losing work?

First check git status --porcelain for uncommitted changes and git log origin/branch..HEAD for unpushed commits. If clean, run git -C .bare worktree remove, prune stale references, and delete the branch with git branch -D.

Why does git worktree add fail with 'branch already exists'?

The branch was created previously and not cleaned up. Delete it with git -C .bare branch -D branch-name, remove any leftover worktree directory, and run git -C .bare worktree prune before retrying.

How do I avoid Maven dependency conflicts between Git worktrees?

Configure each feature worktree with a .mvn/maven.config file pointing maven.repo.local.head to a worktree-local .nop/repository directory. The main branch keeps using the default ~/.m2/repository.

Does git worktree support long paths on Windows?

Yes, but you must enable long path support explicitly by running git -C .bare config core.longpaths true on the bare repository. Without this, checkouts fail with 'Filename too long' errors on paths exceeding 260 characters.