git-worktree

Create, list, and remove Git worktrees for isolated per-task branches.

1|Updated Aug 22, 2024
One-click install
npx skills add https://github.com/opensrcdevelop/auth --skill git-worktree-opensrcdevelop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/opensrcdevelop/auth/tree/main/.claude/skills/git-worktree
Command: npx skills add https://github.com/opensrcdevelop/auth --skill git-worktree-opensrcdevelop

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Git worktrees are often mismanaged or hard to coordinate; this skill provides a simple interface to init, list, and remove per-task worktrees, improving ticket-to-branch workflow and avoiding clutter.

Core Features & Use Cases

  • Initialize a new worktree based on the current branch and remote upstream.
  • List all existing worktrees with their status and associated branches.
  • Remove selected worktrees safely, excluding the main repository.

Quick Start

Provide a task description and run the /git-worktree init command to create a new worktree.

Frequently Asked Questions about git-worktree

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

FAQPage Schema
How do I manage Git worktrees for multi-branch development without cluttering the main repository?

Git worktree management automates the creation, listing, and cleanup of isolated workspaces per feature or bugfix, preventing clutter in the main repository. It provides a simple interface to initialize, list, and remove per-task worktrees safely.

What is the best way to automate Git worktree creation for a new feature branch?

Automating Git worktree creation relies on inferring the current branch and remote upstream to initialize a new worktree. By providing a task description and running the init command, developers can quickly establish an isolated workspace for their specific feature.

How does Git worktree cleanup work to avoid deleting the main repository?

Git worktree cleanup removes selected worktrees safely while explicitly excluding the main repository from deletion. This ensures developers can delete obsolete per-task workspaces without risking the primary working tree or losing the associated upstream branches.

Can I use Git worktree commands with iTerm2 automation for branch workflows?

Yes, Git worktree commands support optional iTerm2 automation to streamline the full lifecycle of per-task worktrees. This integration enhances the ticket-to-branch workflow by automating workspace initialization and terminal management for multi-branch development.

How do I list all existing Git worktrees and their associated branch status?

Listing all existing Git worktrees displays their current status and associated branches. This functionality allows developers to monitor isolated workspaces per feature or bugfix, ensuring accurate tracking of multi-branch development environments.

When do I need to use Git worktree management for isolated workspaces?

You need Git worktree management when working on multiple features or bugfixes simultaneously and requiring isolated workspaces. It prevents branch clutter by maintaining separate working directories linked to the main repository, improving the ticket-to-branch workflow.