AGENT SKILL

git-worktrees

Work on multiple branches simultaneously without stashing or switching. Use when reviewing a PR while mid-feature, applying a hotfix without losing context, or comparing implementations side-by-side. Covers create/list/remove and AS v2 (Windows) conventions.

License 许可
Apache-2.0
最近更新
2026-11-11
Stars
★ 0
Forks
0

01 前言 Front Matter

name
git-worktrees
description
Work on multiple branches simultaneously without stashing or switching. Use when reviewing a PR while mid-feature, applying a hotfix without losing context, or comparing implementations side-by-side. Covers create/list/remove and AS v2 (Windows) conventions.

02 资源文件 1

03 SKILL.md 正文

Git Worktrees

On Windows, use absolute paths (C:/...) for every worktree directory.

Core Commands

Create Worktree

# For existing branch
git worktree add ../project-hotfix hotfix/urgent-bug

# For new branch
git worktree add -b feat/new-feature ../project-feature main

List Worktrees

git worktree list

Remove Worktree

git worktree remove ../project-hotfix
# Or force remove
git worktree remove --force ../project-hotfix

Directory Convention

Organize worktrees predictably:

aprender_sistema/          # Main worktree (main branch)
aprender_sistema-hotfix/   # Hotfix worktree
aprender_sistema-review/   # PR review worktree
aprender_sistema-feat-X/   # Feature worktree

Common Workflows

Workflow 1: Emergency Hotfix

# You're mid-feature on feat/new-ui
git worktree add -b hotfix/critical ../as-hotfix main

# Work in hotfix worktree
cd ../as-hotfix
# Fix, commit, push, PR

# Return to feature
cd ../aprender_sistema

# Cleanup after merge
git worktree remove ../as-hotfix

Workflow 2: PR Review

# Create worktree for the PR branch
git fetch origin
git worktree add ../as-review origin/feat/their-feature

# Review, test, comment (v2 is Docker-only, CP-01)
cd ../as-review
cd v2 && make up
docker exec aprender_dev-web-1 pytest apps/core/tests/ -v

# Cleanup
cd ../aprender_sistema
git worktree remove ../as-review

Workflow 3: Compare Implementations

# Create worktrees for two approaches
git worktree add ../as-approach-a feat/approach-a
git worktree add ../as-approach-b feat/approach-b

# Compare side by side
diff ../as-approach-a/src/feature.py ../as-approach-b/src/feature.py

Best Practices

  1. Name clearly: Include branch purpose in directory name
  2. Clean up: Remove worktrees after done
  3. Don't nest: Keep worktrees as siblings, not children
  4. Share nothing: Each worktree is independent

Caveats and Troubleshooting

For shared-.git gotchas (branch already checked out, locked/stale worktrees, git worktree prune), read reference/caveats-and-troubleshooting.md.

04 同仓库更多 Skills

matheusnorjosa
matheusnorjosa/aprender_sistema

writing-standards

Apply AS v2 technical-writing standards (clarity, brevity, active voice, Python/Django conventions). Use when writing a README, a docstring (PEP 257), a commit message, a PR description, an error message, or any technical doc.

内容创作者写作与文案
★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

verification-gate

Verify before claiming success. Use when about to say something works/is done, after implementing a feature, after a bugfix, or before pushing — run the proof command and confirm output first.

★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

test-driven-development

Write the failing test before the implementation in AS v2 (pytest + Django/DRF). Use when implementing a feature or fixing a bug, before any production code is written.

测试与质量
★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

subagent-development

Orquestra subagents no AS v2 — decompõe a tarefa em domínios independentes, paraleliza e revisa em 2 estágios. Use ao delegar exploração, implementação ou validação cross-arquivo para acelerar o trabalho e poupar o contexto principal.

★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

security-scan

Automated security scanning for AS v2. Use before commits or when reviewing changes for vulnerabilities. Runs dependency audit (pip-audit, npm audit), secret detection (grep patterns), and code pattern scanning (SQL injection, XSS, eval, pickle, hardcoded secrets). Integrates with project hooks system.

★ 0
matheusnorjosa
matheusnorjosa/aprender_sistema

resume-handoff

Resume work from a saved handoff document, validating its state against the current codebase before continuing. Use when resuming work from a saved handoff after a context clear or in a new session (path, session name, or GitHub issue).

人力资源
★ 0