using-git-worktrees

Create isolated Git worktrees with automated setup and baseline tests.

947|163|Updated Jan 13, 2026
One-click install
npx skills add https://github.com/guanyang/antigravity-skills --skill using-git-worktrees-guanyang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/guanyang/antigravity-skills/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/guanyang/antigravity-skills --skill using-git-worktrees-guanyang

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill creates isolated Git worktrees for feature development, ensuring a clean and safe workspace separate from your main development branch, preventing accidental commits and ensuring a stable starting point.

Core Features & Use Cases

  • Isolated Workspaces: Work on multiple branches simultaneously without context switching.
  • Smart Directory Selection: Prioritizes project-local hidden directories (.worktrees/) or user-defined global locations.
  • Safety Verification: Automatically checks if project-local directories are ignored by Git before creation, adding them to .gitignore if necessary.
  • Automated Setup: Detects and runs project-specific setup commands (e.g., npm install, cargo build).
  • Baseline Testing: Runs project tests to ensure the new worktree starts from a clean, working state.
  • Use Case: Before starting a new feature like "user authentication," use this skill to create a dedicated, safe worktree, install dependencies, and verify the baseline is clean, allowing you to focus solely on implementation.

Quick Start

Use the using-git-worktrees skill to create a new worktree for the 'feature/user-auth' branch.

Frequently Asked Questions about using-git-worktrees

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

FAQPage Schema
How do I isolate feature development in Git to avoid accidental commits to my main branch?

Git worktrees isolate feature development by creating separate working directories linked to your repository, ensuring a clean workspace that prevents accidental commits to the main branch. This provides a stable starting point for new features.

How do I set up a Git worktree for a Node.js, Rust, Python, or Go project?

Setting up a Git worktree for Node.js, Rust, Python, or Go projects involves automated directory selection followed by running project-specific setup commands like npm install or cargo build. It then executes baseline tests to verify the worktree starts from a clean state.

Does Git automatically ignore worktree directories created inside my project?

Git does not automatically ignore worktree directories, but this workflow includes safety verification that checks if project-local directories like .worktrees/ are ignored. If necessary, it automatically adds them to .gitignore before creating the worktree.

Can I work on multiple Git branches simultaneously without constantly switching context?

Working on multiple Git branches simultaneously is possible using Git worktrees, which create isolated workspaces for each branch. This allows you to switch between features simply by changing directories, entirely avoiding disruptive context switching.

What is the best way to ensure a new Git worktree starts from a clean working state?

The best way to ensure a new Git worktree starts from a clean working state is to run baseline tests immediately after creating it and installing dependencies. This verifies the isolated environment is fully functional before you begin feature implementation.