Loading...
Loading...
Manage git repositories using the worktree pattern for efficient multi-branch development. Use when: (1) Cloning a repository for the first time, (2) Creating a new worktree for a feature branch, (3) Listing existing worktrees, (4) Removing worktrees after work is complete. The worktree pattern clones once and creates lightweight working directories for each branch, avoiding the overhead of multiple full clones.
npx skill4agent add zfael/brn git-worktree~/dev/personal/auto/
├── my-project/ # Main clone (bare or with default branch)
│ └── .git/
└── my-project-worktrees/ # Worktrees directory
├── feature-123/ # Worktree for feature branch
├── feature-456/ # Another feature branch
└── hotfix-789/ # Hotfix branch| Action | Script |
|---|---|
| Clone repo | |
| Create worktree | |
| List worktrees | |
| Remove worktree | |
# Clone if not already done
./scripts/clone_repo.sh https://github.com/org/my-app.git
# Create worktree for ticket
./scripts/create_worktree.sh my-app PROJ-123-new-feature
# Work in the worktree directory
cd ~/dev/personal/auto/my-app-worktrees/PROJ-123-new-feature./scripts/remove_worktree.sh my-app PROJ-123-new-featureworkspace-manager<workspace_path>/<repo_name>/<workspace_path>/<repo_name>-worktrees/