ganyuanran avatar

Using Git Worktrees

Sets up isolated Git worktrees so you can work on features without polluting your main workspace. Automatically picks the right directory (checks for existing .worktrees or worktrees folders, then CLAUDE.md preferences, then asks), verifies it won't get committed by accident, creates the worktree with a new branch, runs your project setup (npm install, cargo build, whatever), and confirms tests pass before you start. The ignore verification is critical because committing worktree contents is a mess to clean up. Required step before brainstorming moves to implementation or any subagent work starts, pairs with finishing-a-development-branch for cleanup.

GitHub stars
492
last updated
Jun 11, 2026

Install

$ npx -y skills add ganyuanran/aegis --skill using-git-worktrees --agent claude-code

Installs into .claude/skills of the current project.

Files

Using Git Worktrees

Overview

A worktree is an exception for simultaneously checking out another Git history, not a general safety badge. Prefer the current workspace and reuse an existing suitable worktree. A branch decision and a worktree decision are separate.

Core principle: create only with necessity and ownership evidence; pair every created worktree with a cleanup path.

Announce at start: explain which concrete checkout conflict requires a worktree.

Step 0: Environment Detection

Before mutation, record the repository root, HEAD, branch/detached state, staged/unstaged/untracked paths, active Git operations, and:

git worktree list --porcelain

Sponsors

Details

Repository
github.com/ganyuanran/aegis
Category
Git & Pull Requests
License
MIT
First seen
Jun 11, 2026

More from ganyuanran/aegis

All 22
1hoangnguyen0403 avatarcaveman-commithoangnguyen0403/agent-skills-standard>0skills.sh installs
2hoangnguyen0403 avatarcaveman-reviewhoangnguyen0403/agent-skills-standard>0skills.sh installs
3hoangnguyen0403 avatarcodebase-reviewhoangnguyen0403/agent-skills-standardReview an entire codebase against framework best practices and generate a prioritized improvement plan.0skills.sh installs
4hoangnguyen0403 avatarreview-tickethoangnguyen0403/agent-skills-standardReview a ticket or PR through focused specialist lenses: scope, architecture, security, tests, AC coverage, and PR metadata.0skills.sh installs
5laolaoshiren avatargit-workflowlaolaoshiren/claude-code-skills-zhGit 工作流自动化 - 智能分支管理、提交信息生成、PR 创建0skills.sh installs
6metabase avatardocs-reviewmetabase/metabaseReview documentation changes for compliance with the Metabase writing style guide. Use when reviewing pull requests, files, or diffs containing documentation ma0skills.sh installs