You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`-f, --force`| Skip confirmation prompt and pass `--force` to `git worktree remove`|
116
+
117
+
### `wtt <branch>`
118
+
119
+
Navigate directly to a worktree by branch name.
120
+
121
+
```sh
122
+
wtt feature/login
123
+
```
124
+
125
+
### `wtt init`
126
+
127
+
Scaffolds a `.wtt.toml` in the repo root with commented-out defaults.
128
+
129
+
```sh
130
+
wtt init # fails if .wtt.toml already exists
131
+
wtt init -f # overwrite existing file
132
+
```
133
+
134
+
| Flag | Description |
135
+
|---|---|
136
+
|`-f, --force`| Overwrite an existing `.wtt.toml`|
137
+
138
+
### `wtt repo list`
139
+
140
+
Switches the active repository context — kubens-style. After switching, all `wtt` commands (`create`, `list`, `remove`) operate on the selected repo, even when run from outside it.
141
+
142
+
```sh
143
+
wtt repo list
144
+
```
145
+
146
+
### `wtt repo remove`
147
+
148
+
Removes a repository from the known repos list.
149
+
150
+
```sh
151
+
wtt repo remove
152
+
wtt repo remove -f # skip confirmation
153
+
```
154
+
155
+
| Flag | Description |
156
+
|---|---|
157
+
|`-f, --force`| Skip confirmation prompt |
158
+
159
+
---
160
+
58
161
## Configuration
59
162
60
-
Create `.wtt.toml` in your repo root to customize behavior:
163
+
Run `wtt init` to create a `.wtt.toml` in your repo root, then edit it:
164
+
165
+
```sh
166
+
wtt init
167
+
```
168
+
169
+
### Config keys
170
+
171
+
| Key | Type | Default | Description |
172
+
|---|---|---|---|
173
+
|`worktree_dir`| string |`../<repo>-worktrees`| Directory where worktrees are created |
174
+
|`copy_files`| list |`[".gitignore"]`| Files copied from the main worktree into each new worktree |
175
+
|`copy_dirs`| list |`[]`| Directories copied recursively into each new worktree |
176
+
|`symlink_files`| list |`[]`| Files symlinked (not copied) — changes in one worktree are shared across all |
177
+
|`post_create`| list |`[]`| Shell commands run inside the new worktree after creation |
178
+
179
+
### Example `.wtt.toml`
61
180
62
181
```toml
63
-
# Where to put worktrees (default: ../<repo>-worktrees)
182
+
# Where to create worktrees (default: ../<repo>-worktrees)
64
183
worktree_dir = "../myproject-worktrees"
65
184
66
-
# Files to copy from main worktree into each new worktree (default: [".gitignore"])
185
+
# Files copied into each new worktree
67
186
copy_files = [".gitignore", ".env.local"]
68
187
69
-
# Directories to copy recursively
70
-
copy_dirs = []
188
+
# Directories copied recursively
189
+
copy_dirs = ["scripts"]
190
+
191
+
# Files symlinked — edits in any worktree are reflected everywhere
192
+
symlink_files = [".env.secrets"]
71
193
72
-
# Commands to run inside the new worktree after creation
194
+
# Commands run inside the new worktree after creation
73
195
post_create = ["npm install"]
74
196
```
75
197
198
+
---
199
+
200
+
## Shell Prompt
201
+
202
+
`--init` automatically injects the active repository name into your shell prompt — no manual configuration needed.
203
+
204
+
| Shell | Where it appears | Framework notes |
205
+
|---|---|---|
206
+
| zsh | Right prompt (`RPROMPT`) | Auto-injects into Powerlevel10k as a custom segment; falls back to generic `RPROMPT` for plain zsh and oh-my-zsh |
207
+
| bash | Left prompt (`PS1`) | Prepended via `PROMPT_COMMAND`|
208
+
| fish | Right prompt | Defines `fish_right_prompt` if not already set; for Tide/Starship call `wtt_segment` from your theme hook |
209
+
210
+
The prompt segment is powered by `wtt-bin context` internally. There is no separate `wtt context` command intended for direct use.
211
+
212
+
---
213
+
76
214
## How It Works
77
215
78
-
A child process can't change the parent shell's directory, so `wtt` ships as `wtt-bin` plus a shell wrapper function. When a command prints a directory path, the wrapper `cd`s into it — the same pattern used by `nvm` and `direnv`.
216
+
A child process can't change the parent shell's directory, so `wtt` ships as two parts:
217
+
218
+
1.**`wtt-bin`** — the Go binary that does the work
219
+
2.**`wtt`** — a shell function (installed by `--init`) that runs `wtt-bin` and `cd`s into the output if it's a directory
220
+
221
+
This is the same pattern used by tools like `nvm` and `direnv`.
79
222
80
223
Worktrees land at `../<repo>-worktrees/<branch>/` by default. Slashes in branch names become dashes (`feature/login` → `feature-login`).
81
224
225
+
When fzf is not installed, interactive pickers fall back to a numbered list — `wtt list` and `wtt remove` always work regardless.
226
+
227
+
---
228
+
82
229
## Contributing
83
230
84
231
Contributions are welcome! Here's how to get started:
0 commit comments