agent-ops-git-worktree

Manage git worktrees for isolated development. Create, list, remove, and work in worktrees.

16 stars

Best use case

agent-ops-git-worktree is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Manage git worktrees for isolated development. Create, list, remove, and work in worktrees.

Teams using agent-ops-git-worktree should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/agent-ops-git-worktree/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/cli-automation/agent-ops-git-worktree/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/agent-ops-git-worktree/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How agent-ops-git-worktree Compares

Feature / Agentagent-ops-git-worktreeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Manage git worktrees for isolated development. Create, list, remove, and work in worktrees.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Git Worktree Workflow

## When to Use

Use git worktrees when you need to:
- Work on multiple branches simultaneously without stashing
- Isolate experimental work from main repository
- Safely test changes without affecting main working tree
- Create temporary development contexts

## Preconditions

- `.agent/constitution.md` exists
- Git repository initialized
- Worktrees directory exists: `C:\dev\temp\worktrees` (or configured in constitution)

## Procedure

### Create Worktree

1. **Create worktree with branch** (one operation):
   ```bash
   git worktree add <worktree-path> -b <branch-name>
   
   # Example:
   git worktree add C:/dev/temp/worktrees/agent-ops-feat-123 feat/feature-123
   ```

2. **Verify worktree**:
   ```bash
   git worktree list
   
   # Verify directory structure
   ls -la <worktree-path>/.git
   # Should be a file (pointer to main repo .git)
   ```

3. **Navigate to worktree**:
   ```bash
   cd <worktree-path>
   
   # Verify correct branch
   git branch --show-current
   
   # Work normally (git operations work as expected)
   git status
   git add .
   git commit -m "feat: ..."
   ```

### List Worktrees

```bash
# List all worktrees
git worktree list

# Detailed list with branches
git worktree list --porcelain
```

### Remove Worktree

**After work is complete and merged**:
```bash
# Navigate out of worktree
cd <main-repo>

# Remove worktree
git worktree remove <worktree-path>

# Delete feature branch (if merged)
git branch -d <feature-branch>
```

### Worktree Cleanup

**Remove stale worktrees**:
```bash
# List all worktrees
git worktree list

# Remove worktrees for deleted branches
git worktree remove <worktree-path>
```

## Integration with Issue Tracking

When working in a worktree:
1. Update `.agent/focus.md` to reflect worktree location
2. Track issue progress normally (updates worktree's git state)
3. When committing, reference issue ID in commit message

## Example Workflow

```bash
# In main repo (C:\dev\temp\agent-ops)
git worktree add C:/dev/temp/worktrees/agent-ops-opencode feat/opencode-bundle

# In worktree
cd C:/dev/temp/worktrees/agent-ops-opencode
# ... implement changes ...
git add .
git commit -m "feat: implement OpenCodeGenerator enhancements [FEAT-0335]"

# Merge back to main
cd C:/dev/temp/agent-ops
git merge feat/opencode-bundle
git worktree remove C:/dev/temp/worktrees/agent-ops-opencode
```

## Scope

- ✅ Create worktrees
- ✅ List worktrees
- ✅ Remove worktrees
- ✅ Work in worktrees (normal git operations)
- ❌ Prune worktrees (use git worktree prune, which is built-in)

## Notes

- Worktrees are lightweight (share same .git directory)
- Safe to delete worktree directory after removal
- No risk to main repository when working in worktree
- Perfect for feature development, bug fixes, testing

## Important Rules

**Never push without explicit user permission:**
- Git push requires explicit user request before execution
- This is enforced by `agent-ops-git` skill and applies to all workflows
- Auto-push is NEVER permitted, even for successful merges
- Always ask for confirmation before: `git push`

Related Skills

worktree-setup

16
from diegosouzapw/awesome-omni-skill

Automatically invoked after `git worktree add` to create data/shared symlink and data/local directory. Required before starting work in any new worktree.

worktree-tending

16
from diegosouzapw/awesome-omni-skill

Manage git worktrees for parallel branch development using custom git scripts (git-newtree, git-killtree, git-maingulp). Use when creating new worktrees, listing active worktrees, or closing/merging worktrees back to main. All worktrees are stored in .tree/ subdirectories of the repository.

using-git-worktrees

16
from diegosouzapw/awesome-omni-skill

Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verifi...

git-worktree

16
from diegosouzapw/awesome-omni-skill

Git Worktree 管理命令。提供 init、list、remove 三个子命令来管理项目 worktree。

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

pr-review

16
from diegosouzapw/awesome-omni-skill

Guidelines for conducting thorough pull request code reviews

power-bi-report-design-best-practices

16
from diegosouzapw/awesome-omni-skill

Comprehensive Power BI report design and visualization best practices based on Microsoft guidance for creating effective, accessible, and performant reports and dashboards. Triggers on: **/*.{pbix,md,json,txt}

plan-issue

16
from diegosouzapw/awesome-omni-skill

Plan-only workflow for issue/repo changes. Use when user asks to plan, scope, estimate, or design.

pencil-design

16
from diegosouzapw/awesome-omni-skill

Design UIs in Pencil (.pen files) and generate production code from them. Use when working with .pen files, designing screens or components in Pencil, or generating code from Pencil designs. Triggers on tasks involving Pencil, .pen files, design-to-code workflows, or UI design with the Pencil MCP tools.

pattern-extraction

16
from diegosouzapw/awesome-omni-skill

Extract design systems, architecture patterns, and methodology from codebases into reusable skills and documentation. Use when analyzing a project to capture patterns, creating skills from existing code, extracting design tokens, or documenting how a project was built. Triggers on "extract patterns", "extract from this repo", "analyze this codebase", "create skills from this project", "extract design system".

oiloil-ui-ux-guide

16
from diegosouzapw/awesome-omni-skill

Modern, clean UI/UX guidance + review skill. Use when you need actionable UX/UI recommendations, design principles, or a design review checklist for new features or existing systems (web/app). Focus on CRAP (Contrast/Repetition/Alignment/Proximity) plus task-first UX, information architecture, feedback & system status, consistency, affordances, error prevention/recovery, and cognitive load. Enforce a modern minimal style (clean, spacious, typography-led), reduce unnecessary copy, forbid emoji as icons, and recommend intuitive refined icons from a consistent icon set.

nuxt-ui

16
from diegosouzapw/awesome-omni-skill

Use when building styled UI with @nuxt/ui v4 components (Button, Modal, Form, Table, etc.) - provides ready-to-use components with Tailwind Variants theming. Use vue skill for raw component patterns, reka-ui for headless primitives.