22
33A [ copier] ( https://copier.readthedocs.io/ ) template that scaffolds git projects using the
44** bare repo + worktree** pattern described in
5- [ Git Worktrees Done Right] ( https://gabri.me/blog/git-worktrees-done-right ) .
5+ [ Git Worktrees Done Right] ( https://gabri.me/blog/git-worktrees-done-right ) and its followup
6+ [ git-wt: Worktrees Simplified] ( https://gabri.me/blog/git-wt ) by Ahmed el Gabri.
67
78Instead of switching branches with ` git checkout ` , you keep multiple branches checked out
89simultaneously as separate directories (worktrees). A bare clone holds all git data, and
@@ -44,7 +45,9 @@ my-project/
4445│ └── tasks/ # Project tasks
4546│ ├── wt-add # Create a new worktree
4647│ ├── wt-rm # Remove a worktree
48+ │ ├── wt-destroy # Remove worktree + local + remote branch
4749│ ├── wt-ls # List all worktrees
50+ │ ├── wt-update # Fetch remotes and fast-forward main
4851│ ├── repo-public # Create a public GitHub repo
4952│ ├── repo-private # Create a private GitHub repo
5053│ └── remote-add # Add a remote to an existing repo
@@ -70,8 +73,14 @@ cd my-feature/
7073# List all worktrees
7174mise run wt-ls
7275
73- # Clean up when done
76+ # Fetch latest and fast-forward main
77+ mise run wt-update
78+
79+ # Clean up when done (keeps remote branch)
7480mise run wt-rm my-feature
81+
82+ # Or nuke everything: worktree + local + remote branch
83+ mise run wt-destroy my-feature
7584```
7685
7786The ` main/ ` worktree stays pristine as a clean reference for diffing. Never edit files in it
@@ -164,9 +173,11 @@ outside version control.
164173
165174| Task | Usage | Description |
166175| ------| -------| -------------|
167- | ` wt-add ` | ` mise run wt-add <branch> [base] ` | Create a new worktree. Defaults to branching from ` main ` . |
168- | ` wt-rm ` | ` mise run wt-rm <branch> ` | Remove a worktree and its directory. |
176+ | ` wt-add ` | ` mise run wt-add <branch> [base] ` | Create a new worktree. Fetches remotes first, defaults to branching from ` main ` . |
177+ | ` wt-rm ` | ` mise run wt-rm <branch> ` | Remove a worktree and its local branch. |
178+ | ` wt-destroy ` | ` mise run wt-destroy <branch> ` | Remove a worktree and delete both local and remote branches. |
169179| ` wt-ls ` | ` mise run wt-ls ` | List all active worktrees. |
180+ | ` wt-update ` | ` mise run wt-update ` | Fetch all remotes and fast-forward ` main ` . |
170181| ` repo-public ` | ` mise run repo-public <owner/repo> ` | Create a public GitHub repo, set up remote, and push ` main ` . |
171182| ` repo-private ` | ` mise run repo-private <owner/repo> ` | Create a private GitHub repo, set up remote, and push ` main ` . |
172183| ` remote-add ` | ` mise run remote-add <owner/repo> [name] ` | Add an existing GitHub repo as remote and push ` main ` . Defaults remote name to ` origin ` . |
@@ -179,5 +190,11 @@ To add your own, edit `.bare/info/exclude` directly.
179190
180191## Credit
181192
182- Based on the workflow from [ Git Worktrees Done Right] ( https://gabri.me/blog/git-worktrees-done-right )
183- by Ahmed el Gabri.
193+ Based on the workflow from Ahmed el Gabri:
194+
195+ - [ Git Worktrees Done Right] ( https://gabri.me/blog/git-worktrees-done-right ) -- the bare repo
196+ + worktree pattern that this template scaffolds.
197+ - [ git-wt: Worktrees Simplified] ( https://gabri.me/blog/git-wt ) -- a standalone CLI tool that
198+ wraps the same pattern. Several of our mise tasks (` wt-update ` , ` wt-destroy ` , fetch-before-add)
199+ are inspired by ` git-wt ` 's approach. If you prefer a single CLI over mise tasks, check out
200+ [ git-wt] ( https://github.com/ahmedelgabri/git-wt ) .
0 commit comments