Agent skill
git-worktree-workflow-best-practices
Sub-skill of git-worktree-workflow: Best Practices.
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/_archive/development/git-worktree-workflow/best-practices
SKILL.md
Best Practices
Best Practices
Do
- Use descriptive naming convention:
<project>-<purpose> - Create worktrees in sibling directories (not inside project)
- Commit or stash changes before removing worktrees
- Prune stale worktrees regularly
- Document active worktrees in team communication
- Clean up merged worktrees promptly
Don't
- Create worktrees inside the main project directory
- Leave uncommitted changes in worktrees before removal
- Forget to merge/push changes from worktrees
- Create excessive worktrees (manage actively)
- Use worktrees for long-lived branches (use separate clones)
- Skip the cleanup step after merging
Naming Convention
# Pattern: <project>-<purpose>
../project-feature-auth # Feature work
../project-hotfix-123 # Bug fix
../project-review # Code review
../project-test # Testing
../project-experiment # Experiments
Workspace Organization
/workspace/
├── project/ # Main development
├── project-feature-a/ # Active features
├── project-feature-b/
├── project-review/ # Review worktree
└── project-archive/ # Completed features (before cleanup)
Cleanup Script
#!/bin/bash
# cleanup-worktrees.sh
# Remove merged branches
git branch --merged main | grep -v main | while read branch; do
worktree=$(git worktree list | grep "$branch" | awk '{print $1}')
if [ -n "$worktree" ]; then
echo "Removing worktree: $worktree"
git worktree remove "$worktree"
fi
done
# Prune stale references
git worktree prune
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?