easy-worktree 0.1.1__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/PKG-INFO +88 -9
- easy_worktree-0.1.3/README.md +237 -0
- easy_worktree-0.1.3/README_ja.md +235 -0
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/easy_worktree/__init__.py +399 -174
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/pyproject.toml +1 -1
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/tests/test_integration.py +152 -17
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/uv.lock +1 -1
- easy_worktree-0.1.1/README.md +0 -158
- easy_worktree-0.1.1/README_ja.md +0 -155
- easy_worktree-0.1.1/memo/.claude/commands/artifacts-variants.md +0 -189
- easy_worktree-0.1.1/memo/.claude/commands/artifacts.md +0 -115
- easy_worktree-0.1.1/memo/.claude/commands/bucket-list.md +0 -99
- easy_worktree-0.1.1/memo/.claude/commands/daily-task.md +0 -174
- easy_worktree-0.1.1/memo/.claude/commands/memo-scratch.md +0 -108
- easy_worktree-0.1.1/memo/.claude/commands/new-year-resolution.md +0 -244
- easy_worktree-0.1.1/memo/.claude/commands/screenshot.md +0 -93
- easy_worktree-0.1.1/memo/.claude/commands/tech-blog.md +0 -178
- easy_worktree-0.1.1/memo/.claude/settings.json +0 -6
- easy_worktree-0.1.1/memo/.cursor/rules/artifacts-variants.md +0 -175
- easy_worktree-0.1.1/memo/.cursor/rules/artifacts.md +0 -105
- easy_worktree-0.1.1/memo/.cursor/rules/bucket-list.md +0 -96
- easy_worktree-0.1.1/memo/.cursor/rules/daily-task.md +0 -172
- easy_worktree-0.1.1/memo/.cursor/rules/memo-scratch.md +0 -105
- easy_worktree-0.1.1/memo/.cursor/rules/new-year-resolution.md +0 -244
- easy_worktree-0.1.1/memo/.cursor/rules/tech-blog.md +0 -175
- easy_worktree-0.1.1/memo/.github/chatmodes/artifacts-variants.chatmode.md +0 -154
- easy_worktree-0.1.1/memo/.github/chatmodes/artifacts.chatmode.md +0 -108
- easy_worktree-0.1.1/memo/.github/chatmodes/bucket-list.chatmode.md +0 -99
- easy_worktree-0.1.1/memo/.github/chatmodes/daily-task.chatmode.md +0 -176
- easy_worktree-0.1.1/memo/.github/chatmodes/memo-scratch.chatmode.md +0 -108
- easy_worktree-0.1.1/memo/.github/chatmodes/new-year-resolution.chatmode.md +0 -247
- easy_worktree-0.1.1/memo/.github/chatmodes/tech-blog.chatmode.md +0 -178
- easy_worktree-0.1.1/memo/.github/instructions/main.instructions.md +0 -8
- easy_worktree-0.1.1/memo/.gitignore +0 -4
- easy_worktree-0.1.1/memo/.vscode/mcp.json +0 -18
- easy_worktree-0.1.1/memo/.vscode/settings.json +0 -22
- easy_worktree-0.1.1/memo/.wt/.gitignore +0 -1
- easy_worktree-0.1.1/memo/.wt/README.md +0 -81
- easy_worktree-0.1.1/memo/.wt/config.toml +0 -3
- easy_worktree-0.1.1/memo/.wt/post-add +0 -28
- easy_worktree-0.1.1/memo/CLAUDE.md +0 -76
- easy_worktree-0.1.1/memo/README.md +0 -6
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/README.md +0 -119
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/index.html +0 -386
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/ai-review-category-changed.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/ai-review-loading-state.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/ai-review-mobile-view.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/ai-review-prototype-initial.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/ai-review-translation-tab.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/popover-all-checked-new.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/popover-all-checked.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/popover-closed-final-new.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/popover-closed-final.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/popover-opened.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/screenshots/updated-initial-view.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/variants/README.md +0 -183
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/variants/analytics-dashboard-initial.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/variants/analytics-dashboard.html +0 -841
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/variants/batch-processing-initial.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/variants/batch-processing.html +0 -596
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/variants/collaboration-initial.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/ai-review-prototype/variants/collaboration.html +0 -796
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/README.md +0 -114
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/index.html +0 -488
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/screenshot-initial.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern1-ai-auto-correction.html +0 -628
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern1-ai-auto-correction.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern10-table-with-precedent.html +0 -954
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern10-table-with-precedent.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern11-interactive-matrix.html +0 -1038
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern11-interactive-matrix.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern12-smart-dashboard.html +0 -1228
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern12-smart-dashboard.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern13-translation-focused.html +0 -1117
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern13-translation-focused.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern14-smart-workbench.html +0 -1278
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern14-smart-workbench.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern15-slide-match.html +0 -1644
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern15-slide-match.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern2-collaboration.html +0 -794
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern2-collaboration.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern3-intelligent-analysis.html +0 -888
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern3-intelligent-analysis.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern4-card-view.html +0 -768
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern4-card-view.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern5-table-view.html +0 -1005
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern5-table-view.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern6-timeline-view.html +0 -879
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern6-timeline-view.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern7-industry-reference.html +0 -881
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern7-industry-reference.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern8-precedent-search.html +0 -915
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern8-precedent-search.png +0 -0
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern9-trust-approval.html +0 -1092
- easy_worktree-0.1.1/memo/artifacts/translation-list-prototype/variants/pattern9-trust-approval.png +0 -0
- easy_worktree-0.1.1/memo/blog/2025-06-30-tech-trends-2025-mid-year.md +0 -562
- easy_worktree-0.1.1/memo/blog/2025-06-30-vscode-custom-chat-modes-guide.md +0 -289
- easy_worktree-0.1.1/memo/blog/engineer-designer-collaboration-guide.md +0 -616
- easy_worktree-0.1.1/memo/blog/img/429.png +0 -0
- easy_worktree-0.1.1/memo/blog/img/case-management.png +0 -0
- easy_worktree-0.1.1/memo/blog/img/ddtrace.png +0 -0
- easy_worktree-0.1.1/memo/blog/img/irhub-file.png +0 -0
- easy_worktree-0.1.1/memo/blog/img/term.png +0 -0
- easy_worktree-0.1.1/memo/blog/irhub-translation-development-thinking-list-raw.md +0 -38
- easy_worktree-0.1.1/memo/blog/irhub-translation-development-thinking-list.md +0 -304
- easy_worktree-0.1.1/memo/blog/irhub-translation-development.md +0 -156
- easy_worktree-0.1.1/memo/daily-tasks/2025-06-27.md +0 -45
- easy_worktree-0.1.1/memo/daily-tasks/2025-06-30.md +0 -41
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-02.md +0 -50
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-03.md +0 -56
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-04.md +0 -76
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-07.md +0 -77
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-08.md +0 -84
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-09.md +0 -83
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-10.md +0 -84
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-16.md +0 -80
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-17.md +0 -78
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-18.md +0 -76
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-22.md +0 -81
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-23.md +0 -81
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-25.md +0 -77
- easy_worktree-0.1.1/memo/daily-tasks/2025-07-30.md +0 -78
- easy_worktree-0.1.1/memo/daily-tasks/2025-08-03.md +0 -82
- easy_worktree-0.1.1/memo/daily-tasks/2025-08-27.md +0 -83
- easy_worktree-0.1.1/memo/daily-tasks/2025-12-04.md +0 -77
- easy_worktree-0.1.1/memo/memo/2025-12-10-interview.md +0 -53
- easy_worktree-0.1.1/memo/memo/hoge.md +0 -1
- easy_worktree-0.1.1/memo/memo-scratch.md +0 -57
- easy_worktree-0.1.1/memo/new-year-resolution.md +0 -300
- easy_worktree-0.1.1/memo/trash-box/Makefile +0 -9
- easy_worktree-0.1.1/memo/trash-box/datadoglog.json +0 -28
- easy_worktree-0.1.1/memo/trash-box/docs/a.md +0 -9
- easy_worktree-0.1.1/memo/trash-box/docs/b.md +0 -44
- easy_worktree-0.1.1/memo/trash-box/docs/c.md +0 -4
- easy_worktree-0.1.1/memo/trash-box/docs/d.md +0 -27
- easy_worktree-0.1.1/memo/trash-box/docs/e.md +0 -43
- easy_worktree-0.1.1/memo/trash-box/docs/f.md +0 -14
- easy_worktree-0.1.1/memo/trash-box/inbox.md +0 -5
- easy_worktree-0.1.1/memo/trash-box/spec.template.md +0 -72
- easy_worktree-0.1.1/memo/work-goal/2025/first-half-goal.md +0 -82
- easy_worktree-0.1.1/memo/work-goal/2025/memo/ai-task-tree.md +0 -154
- easy_worktree-0.1.1/memo/work-goal/2025/memo/problem-solution-tree.md +0 -79
- easy_worktree-0.1.1/memo/work-goal/2025/memo/weekly-schedule-analysis.md +0 -80
- easy_worktree-0.1.1/memo/work-goal/2025/todo-list.md +0 -29
- easy_worktree-0.1.1/memo/workspace/practice.py +0 -450
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/.gitignore +0 -0
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/.python-version +0 -0
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/DEPLOY.md +0 -0
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/GEMINI.md +0 -0
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/LICENSE +0 -0
- {easy_worktree-0.1.1 → easy_worktree-0.1.3}/hero.png +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: easy-worktree
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Git worktree を簡単に管理するための CLI ツール
|
|
5
5
|
Project-URL: Homepage, https://github.com/igtm/easy-worktree
|
|
6
6
|
Project-URL: Repository, https://github.com/igtm/easy-worktree
|
|
@@ -35,11 +35,11 @@ It keeps the root of your git repository as your primary working area (main), wh
|
|
|
35
35
|
|
|
36
36
|
### Key Features
|
|
37
37
|
|
|
38
|
-
- **
|
|
39
|
-
- **Auto
|
|
38
|
+
- **Smart Selection**: Quickly switch between worktrees with `wt select`. "Jump" into a new shell instantly without any special setup.
|
|
39
|
+
- **Auto Setup**: Automatically copy files (like `.env`) and run hooks to prepare each worktree.
|
|
40
40
|
- **Clear Status**: `wt list` shows worktree branches, their status (clean/dirty), and associated GitHub PRs in a beautiful table.
|
|
41
41
|
- **Smart Cleanup**: Easily batch remove merged branches or old unused worktrees.
|
|
42
|
-
- **Two-letter shortcuts**: Fast execution with shortcuts like `ad`, `ls`, `
|
|
42
|
+
- **Two-letter shortcuts**: Fast execution with shortcuts like `ad`, `ls`, `sl`, `su`, `st`, `cl`.
|
|
43
43
|
|
|
44
44
|
## Prerequisites
|
|
45
45
|
|
|
@@ -107,6 +107,14 @@ You can also specify a base branch:
|
|
|
107
107
|
wt add feature-1 main
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
+
#### Skip Setup
|
|
111
|
+
|
|
112
|
+
If you want to create a worktree without running the automatic setup (file copy and hooks):
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
wt add feature-1 --skip-setup
|
|
116
|
+
```
|
|
117
|
+
|
|
110
118
|
#### List worktrees
|
|
111
119
|
|
|
112
120
|
```bash
|
|
@@ -123,6 +131,23 @@ Quickly stash your current changes and move them to a new worktree.
|
|
|
123
131
|
wt stash feature-2
|
|
124
132
|
```
|
|
125
133
|
|
|
134
|
+
#### Switch Worktree (shortcut: `sl`)
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
wt select feature-1
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Running `wt select` will **automatically "jump"** you into the worktree directory by starting a new subshell.
|
|
141
|
+
|
|
142
|
+
- **Prompt**: Shows a `(wt:feature-1)` indicator.
|
|
143
|
+
- **Terminal Title**: Updates the window title to `wt:feature-1`.
|
|
144
|
+
- **Tmux**: Updates the tmux window name to `wt:feature-1` if running inside tmux.
|
|
145
|
+
|
|
146
|
+
To return to your original directory, simply type `exit` or press `Ctrl-D`.
|
|
147
|
+
|
|
148
|
+
* **Interactive Mode**: Running `wt select` without arguments opens an interactive picker using `fzf`.
|
|
149
|
+
* **Nesting Control**: If you are already in a `wt` subshell, it will warn you to avoid confusing nesting.
|
|
150
|
+
|
|
126
151
|
#### PR Management
|
|
127
152
|
|
|
128
153
|
Fetch a PR and create a worktree for it. (Requires `gh` CLI)
|
|
@@ -141,12 +166,63 @@ Removes the worktree and its directory.
|
|
|
141
166
|
|
|
142
167
|
### Useful Features
|
|
143
168
|
|
|
144
|
-
####
|
|
169
|
+
#### Setup Worktree (shortcut: `su`)
|
|
145
170
|
|
|
146
|
-
|
|
171
|
+
Initialize the current worktree by copying required files and running the `post-add` hook.
|
|
147
172
|
|
|
148
173
|
```bash
|
|
149
|
-
wt
|
|
174
|
+
wt setup
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Visualization and External Tools
|
|
178
|
+
|
|
179
|
+
When you switch to a worktree using `wt select`, the following features are automatically enabled:
|
|
180
|
+
- **Terminal Title**: The window or tab title is updated to `wt:worktree-name`.
|
|
181
|
+
- **Tmux**: If you are inside tmux, the window name is automatically renamed to `wt:worktree-name`.
|
|
182
|
+
|
|
183
|
+
You can also use the `wt current` (or `cur`) command to display the current worktree name in external tools.
|
|
184
|
+
|
|
185
|
+
##### Tmux Status Bar
|
|
186
|
+
Add the following to your `.tmux.conf` to show the worktree name in your status line:
|
|
187
|
+
```tmux
|
|
188
|
+
set -g status-right "#(wt current) | %Y-%m-%d %H:%M"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
##### Zsh / Bash Prompt
|
|
192
|
+
You can customize your prompt using the `$WT_SESSION_NAME` environment variable.
|
|
193
|
+
|
|
194
|
+
**Zsh (.zshrc)**:
|
|
195
|
+
```zsh
|
|
196
|
+
RPROMPT='${WT_SESSION_NAME:+"(wt:$WT_SESSION_NAME)"} '"$RPROMPT"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Bash (.bashrc)**:
|
|
200
|
+
```bash
|
|
201
|
+
PS1='$(if [ -n "$WT_SESSION_NAME" ]; then echo "($WT_SESSION_NAME) "; fi)'$PS1
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
##### Starship
|
|
205
|
+
Add a custom module to your `starship.toml`:
|
|
206
|
+
```toml
|
|
207
|
+
[custom.easy_worktree]
|
|
208
|
+
command = "wt current"
|
|
209
|
+
when = 'test -n "$WT_SESSION_NAME"'
|
|
210
|
+
format = "via [$symbol$output]($style) "
|
|
211
|
+
symbol = "🌳 "
|
|
212
|
+
style = "bold green"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
##### Powerlevel10k
|
|
216
|
+
Integrate beautiful worktree indicators by adding a custom segment to `.p10k.zsh`:
|
|
217
|
+
|
|
218
|
+
1. Add `easy_worktree` to `POWERLEVEL9K_LEFT_PROMPT_ELEMENTS`.
|
|
219
|
+
2. Define the following function:
|
|
220
|
+
```zsh
|
|
221
|
+
function prompt_easy_worktree() {
|
|
222
|
+
if [[ -n $WT_SESSION_NAME ]]; then
|
|
223
|
+
p10k segment -f 255 -b 28 -i '🌳' -t "wt:$WT_SESSION_NAME"
|
|
224
|
+
fi
|
|
225
|
+
}
|
|
150
226
|
```
|
|
151
227
|
|
|
152
228
|
|
|
@@ -166,10 +242,13 @@ Customize behavior in `.wt/config.toml`:
|
|
|
166
242
|
|
|
167
243
|
```toml
|
|
168
244
|
worktrees_dir = ".worktrees" # Directory where worktrees are created
|
|
169
|
-
|
|
170
|
-
auto_copy_on_add = true # Enable auto-sync on add
|
|
245
|
+
setup_files = [".env"] # Files to auto-copy during setup
|
|
171
246
|
```
|
|
172
247
|
|
|
248
|
+
#### Local Configuration Override
|
|
249
|
+
|
|
250
|
+
You can create `.wt/config.local.toml` to override settings locally. This file is automatically added to `.gitignore` and ignores `config.toml` settings.
|
|
251
|
+
|
|
173
252
|
## Hooks
|
|
174
253
|
|
|
175
254
|
You can define scripts to run automatically after `wt add`.
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# easy-worktree
|
|
4
|
+
|
|
5
|
+
A CLI tool for easy Git worktree management.
|
|
6
|
+
|
|
7
|
+
[日本語版 README](README_ja.md)
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
`easy-worktree` simplifies git worktree management.
|
|
12
|
+
It keeps the root of your git repository as your primary working area (main), while managing other worktrees in a subdirectory (default: `.worktrees/`).
|
|
13
|
+
|
|
14
|
+
### Key Features
|
|
15
|
+
|
|
16
|
+
- **Smart Selection**: Quickly switch between worktrees with `wt select`. "Jump" into a new shell instantly without any special setup.
|
|
17
|
+
- **Auto Setup**: Automatically copy files (like `.env`) and run hooks to prepare each worktree.
|
|
18
|
+
- **Clear Status**: `wt list` shows worktree branches, their status (clean/dirty), and associated GitHub PRs in a beautiful table.
|
|
19
|
+
- **Smart Cleanup**: Easily batch remove merged branches or old unused worktrees.
|
|
20
|
+
- **Two-letter shortcuts**: Fast execution with shortcuts like `ad`, `ls`, `sl`, `su`, `st`, `cl`.
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
`easy-worktree` requires the following:
|
|
25
|
+
|
|
26
|
+
- **Git**: 2.34 or higher recommended.
|
|
27
|
+
- **GitHub CLI (gh)**: Required for PR features (`wt list --pr`, `wt pr add`, `wt clean --merged`). [Installation guide](https://cli.github.com/).
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install easy-worktree
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or install the development version:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
git clone https://github.com/igtm/easy-worktree.git
|
|
39
|
+
cd easy-worktree
|
|
40
|
+
pip install -e .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### Getting Started
|
|
46
|
+
|
|
47
|
+
#### Clone a new repository
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
wt clone https://github.com/user/repo.git
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This clones the repository and initializes `easy-worktree` configuration.
|
|
54
|
+
|
|
55
|
+
#### Initialize an existing repository
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cd my-repo/
|
|
59
|
+
wt init
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Initializes `easy-worktree` in the current repository. Your main repository stays at the project root.
|
|
63
|
+
|
|
64
|
+
### Managing Worktrees
|
|
65
|
+
|
|
66
|
+
#### Add a worktree (shortcut: `ad`)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
wt add feature-1
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This creates the following structure:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
my-repo/ (main)
|
|
76
|
+
.worktrees/
|
|
77
|
+
feature-1/ # Your new worktree
|
|
78
|
+
.wt/
|
|
79
|
+
...
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You can also specify a base branch:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
wt add feature-1 main
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Skip Setup
|
|
89
|
+
|
|
90
|
+
If you want to create a worktree without running the automatic setup (file copy and hooks):
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
wt add feature-1 --skip-setup
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### List worktrees
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
wt list
|
|
100
|
+
wt list --pr # Show PR information
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
#### Stash and Move (shortcut: `st`)
|
|
105
|
+
|
|
106
|
+
Quickly stash your current changes and move them to a new worktree.
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
wt stash feature-2
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Switch Worktree (shortcut: `sl`)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
wt select feature-1
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Running `wt select` will **automatically "jump"** you into the worktree directory by starting a new subshell.
|
|
119
|
+
|
|
120
|
+
- **Prompt**: Shows a `(wt:feature-1)` indicator.
|
|
121
|
+
- **Terminal Title**: Updates the window title to `wt:feature-1`.
|
|
122
|
+
- **Tmux**: Updates the tmux window name to `wt:feature-1` if running inside tmux.
|
|
123
|
+
|
|
124
|
+
To return to your original directory, simply type `exit` or press `Ctrl-D`.
|
|
125
|
+
|
|
126
|
+
* **Interactive Mode**: Running `wt select` without arguments opens an interactive picker using `fzf`.
|
|
127
|
+
* **Nesting Control**: If you are already in a `wt` subshell, it will warn you to avoid confusing nesting.
|
|
128
|
+
|
|
129
|
+
#### PR Management
|
|
130
|
+
|
|
131
|
+
Fetch a PR and create a worktree for it. (Requires `gh` CLI)
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
wt pr add 123 # Fetches PR #123 and creates 'pr@123' worktree
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Remove a worktree
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
wt rm feature-1
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Removes the worktree and its directory.
|
|
144
|
+
|
|
145
|
+
### Useful Features
|
|
146
|
+
|
|
147
|
+
#### Setup Worktree (shortcut: `su`)
|
|
148
|
+
|
|
149
|
+
Initialize the current worktree by copying required files and running the `post-add` hook.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
wt setup
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### Visualization and External Tools
|
|
156
|
+
|
|
157
|
+
When you switch to a worktree using `wt select`, the following features are automatically enabled:
|
|
158
|
+
- **Terminal Title**: The window or tab title is updated to `wt:worktree-name`.
|
|
159
|
+
- **Tmux**: If you are inside tmux, the window name is automatically renamed to `wt:worktree-name`.
|
|
160
|
+
|
|
161
|
+
You can also use the `wt current` (or `cur`) command to display the current worktree name in external tools.
|
|
162
|
+
|
|
163
|
+
##### Tmux Status Bar
|
|
164
|
+
Add the following to your `.tmux.conf` to show the worktree name in your status line:
|
|
165
|
+
```tmux
|
|
166
|
+
set -g status-right "#(wt current) | %Y-%m-%d %H:%M"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
##### Zsh / Bash Prompt
|
|
170
|
+
You can customize your prompt using the `$WT_SESSION_NAME` environment variable.
|
|
171
|
+
|
|
172
|
+
**Zsh (.zshrc)**:
|
|
173
|
+
```zsh
|
|
174
|
+
RPROMPT='${WT_SESSION_NAME:+"(wt:$WT_SESSION_NAME)"} '"$RPROMPT"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Bash (.bashrc)**:
|
|
178
|
+
```bash
|
|
179
|
+
PS1='$(if [ -n "$WT_SESSION_NAME" ]; then echo "($WT_SESSION_NAME) "; fi)'$PS1
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
##### Starship
|
|
183
|
+
Add a custom module to your `starship.toml`:
|
|
184
|
+
```toml
|
|
185
|
+
[custom.easy_worktree]
|
|
186
|
+
command = "wt current"
|
|
187
|
+
when = 'test -n "$WT_SESSION_NAME"'
|
|
188
|
+
format = "via [$symbol$output]($style) "
|
|
189
|
+
symbol = "🌳 "
|
|
190
|
+
style = "bold green"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
##### Powerlevel10k
|
|
194
|
+
Integrate beautiful worktree indicators by adding a custom segment to `.p10k.zsh`:
|
|
195
|
+
|
|
196
|
+
1. Add `easy_worktree` to `POWERLEVEL9K_LEFT_PROMPT_ELEMENTS`.
|
|
197
|
+
2. Define the following function:
|
|
198
|
+
```zsh
|
|
199
|
+
function prompt_easy_worktree() {
|
|
200
|
+
if [[ -n $WT_SESSION_NAME ]]; then
|
|
201
|
+
p10k segment -f 255 -b 28 -i '🌳' -t "wt:$WT_SESSION_NAME"
|
|
202
|
+
fi
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
#### Cleanup (shortcut: `cl`)
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
wt clean --merged
|
|
211
|
+
wt clean --closed # Remove worktrees for closed (unmerged) PRs
|
|
212
|
+
wt clean --days 30
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
### Configuration
|
|
218
|
+
|
|
219
|
+
Customize behavior in `.wt/config.toml`:
|
|
220
|
+
|
|
221
|
+
```toml
|
|
222
|
+
worktrees_dir = ".worktrees" # Directory where worktrees are created
|
|
223
|
+
setup_files = [".env"] # Files to auto-copy during setup
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
#### Local Configuration Override
|
|
227
|
+
|
|
228
|
+
You can create `.wt/config.local.toml` to override settings locally. This file is automatically added to `.gitignore` and ignores `config.toml` settings.
|
|
229
|
+
|
|
230
|
+
## Hooks
|
|
231
|
+
|
|
232
|
+
You can define scripts to run automatically after `wt add`.
|
|
233
|
+
Templates are created in `.wt/post-add` upon initialization.
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
MIT License
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# easy-worktree
|
|
4
|
+
|
|
5
|
+
Git worktree を簡単に管理するための CLI ツール
|
|
6
|
+
|
|
7
|
+
## 概要
|
|
8
|
+
|
|
9
|
+
`easy-worktree` は git worktree の管理をシンプルにするためのツールです。
|
|
10
|
+
リポジトリのルートディレクトリをそのままメインの作業場所(main)として使いつつ、他のブランチでの作業が必要な場合はサブディレクトリ(デフォルトでは `.worktrees/`)に worktree を作成して管理します。
|
|
11
|
+
|
|
12
|
+
### 主な特徴
|
|
13
|
+
|
|
14
|
+
- **スマートな切り替え**: `wt select` で作業ディレクトリを瞬時に切り替え。特別な設定なしで新しいシェルとして「ジャンプ」できます。
|
|
15
|
+
- **自動セットアップ**: `.env` などのファイルをルートから各 worktree へ自動的にコピー・初期化できます。
|
|
16
|
+
- **わかりやすい一覧表示**: `wt list` で worktree の一覧、ブランチ、状態(clean/dirty)、GitHub PR 情報を美しく表示します。
|
|
17
|
+
- **スマートなクリーンアップ**: マージ済みのブランチや古い worktree を簡単に削除できるようになります。
|
|
18
|
+
- **2文字ショートカット**: `ad`, `ls`, `sl`, `su`, `st`, `cl` といった短いコマンドで素早く操作できます。
|
|
19
|
+
|
|
20
|
+
## 前提条件
|
|
21
|
+
|
|
22
|
+
`easy-worktree` には以下が必要です:
|
|
23
|
+
|
|
24
|
+
- **Git**: 2.34 以上を推奨します。
|
|
25
|
+
- **GitHub CLI (gh)**: PR 関連機能(`wt list --pr`, `wt pr add`, `wt clean --merged`)を利用する場合に必要です。[インストール方法](https://cli.github.com/)。
|
|
26
|
+
|
|
27
|
+
## インストール
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install easy-worktree
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
または開発版をインストール:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone https://github.com/igtm/easy-worktree.git
|
|
37
|
+
cd easy-worktree
|
|
38
|
+
pip install -e .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 使い方
|
|
42
|
+
|
|
43
|
+
### リポジトリの準備
|
|
44
|
+
|
|
45
|
+
#### 新しくクローンする場合
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
wt clone https://github.com/user/repo.git
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
リポジトリをクローンし、`easy-worktree` 用の初期設定を自動で行います。
|
|
52
|
+
|
|
53
|
+
#### 既存のリポジトリで使い始める場合
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cd my-repo/
|
|
57
|
+
wt init
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
現在のディレクトリをメインリポジトリ(ルート)として `easy-worktree` を初期化します。既存のリポジトリ構成はそのまま維持されます。
|
|
61
|
+
|
|
62
|
+
### worktree の操作
|
|
63
|
+
|
|
64
|
+
#### worktree を追加 (ショートカット: `ad`)
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
wt add feature-1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
これにより、以下のディレクトリ構成が作成されます:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
my-repo/ (main)
|
|
74
|
+
.worktrees/
|
|
75
|
+
feature-1/ # ここが新しい worktree
|
|
76
|
+
.wt/
|
|
77
|
+
...
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
既存のブランチを指定して作成することもできます:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
wt add feature-1 main
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
#### セットアップをスキップする
|
|
87
|
+
|
|
88
|
+
自動セットアップ(ファイルのコピーや hook の実行)を行わずに worktree を作成したい場合は、`--skip-setup` フラグを使用します:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
wt add feature-1 --skip-setup
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
#### 一覧を表示 (ショートカット: `ls`)
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
wt list
|
|
98
|
+
wt ls --pr # GitHub の PR 情報もあわせて表示
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
#### スタッシュと移動 (ショートカット: `st`)
|
|
103
|
+
|
|
104
|
+
現在の変更をスタッシュし、そのまま新しい worktree を作成して移動します。
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
wt stash feature-2
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### ワークツリーを切り替える (ショートカット: `sl`)
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
wt select feature-1
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`wt select` を実行すると、そのワークツリーのディレクトリへ**自動的に「ジャンプ」**します(新しいシェルが起動します)。
|
|
117
|
+
|
|
118
|
+
- **プロンプト**: `(wt:feature-1)` のように表示されます。
|
|
119
|
+
- **ターミナルタイトル**: ウィンドウのタイトル(ターミナルのタブ名など)が `wt:feature-1` に更新されます。
|
|
120
|
+
- **Tmux**: tmux 内で実行している場合、ウィンドウ名が `wt:feature-1` に更新されます。
|
|
121
|
+
|
|
122
|
+
元のディレクトリに戻りたい場合は `exit` を実行するか `Ctrl-D` を押してください。
|
|
123
|
+
|
|
124
|
+
※ すでに `wt` のサブシェル内にいる状態で再度実行すると、ネストを警告するメッセージが表示されます。ネストを避けるには一度 `exit` してから切り替えることをお勧めします。
|
|
125
|
+
|
|
126
|
+
引数なしで実行すると `fzf` によるインタラクティブな選択が可能です。
|
|
127
|
+
|
|
128
|
+
#### PR 管理
|
|
129
|
+
|
|
130
|
+
GitHub の PR を取得して worktree を作成します(`gh` CLI が必要です)。
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
wt pr add 123 # PR #123 を取得し 'pr@123' という名前で worktree を作成
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### 削除
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
wt rm feature-1
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
ディレクトリごと worktree を削除します。
|
|
143
|
+
|
|
144
|
+
### 便利な機能
|
|
145
|
+
|
|
146
|
+
#### ワークツリーの初期化 (ショートカット: `su`)
|
|
147
|
+
|
|
148
|
+
`.env` ファイルなどのコピーや `post-add` フックの実行を、現在のワークツリーに対して行います。
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
wt setup
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### 可視化と外部ツールとの連携
|
|
155
|
+
|
|
156
|
+
`wt select` でワークツリーに切り替えた際、以下の機能が自動的に有効になります:
|
|
157
|
+
- **ターミナルタイトル**: ウィンドウやタブのタイトルが `wt:ワークツリー名` に更新されます。
|
|
158
|
+
- **Tmux**: tmux 内にいる場合、ウィンドウ名が自動的に `wt:ワークツリー名` に変更されます。
|
|
159
|
+
|
|
160
|
+
また、`wt current` (または `cur`) コマンドを使って、外部ツールに現在のワークツリー情報を表示できます。
|
|
161
|
+
|
|
162
|
+
##### Tmux ステータスバー
|
|
163
|
+
`.tmux.conf` に以下を追加して、ステータスラインに常時表示できます。
|
|
164
|
+
```tmux
|
|
165
|
+
set -g status-right "#(wt current) | %Y-%m-%d %H:%M"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
##### Zsh / Bash プロンプト
|
|
169
|
+
環境変数 `$WT_SESSION_NAME` を利用してプロンプトをカスタマイズできます。
|
|
170
|
+
|
|
171
|
+
**Zsh (.zshrc)**:
|
|
172
|
+
```zsh
|
|
173
|
+
RPROMPT='${WT_SESSION_NAME:+"(wt:$WT_SESSION_NAME)"} '"$RPROMPT"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Bash (.bashrc)**:
|
|
177
|
+
```bash
|
|
178
|
+
PS1='$(if [ -n "$WT_SESSION_NAME" ]; then echo "($WT_SESSION_NAME) "; fi)'$PS1
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
##### Starship
|
|
182
|
+
`starship.toml` にカスタムモジュールを追加します。
|
|
183
|
+
```toml
|
|
184
|
+
[custom.easy_worktree]
|
|
185
|
+
command = "wt current"
|
|
186
|
+
when = 'test -n "$WT_SESSION_NAME"'
|
|
187
|
+
format = "via [$symbol$output]($style) "
|
|
188
|
+
symbol = "🌳 "
|
|
189
|
+
style = "bold green"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
##### Powerlevel10k
|
|
193
|
+
`.p10k.zsh` にカスタムセグメントを定義することで、綺麗に統合できます。
|
|
194
|
+
|
|
195
|
+
1. `POWERLEVEL9K_LEFT_PROMPT_ELEMENTS` に `easy_worktree` を追加。
|
|
196
|
+
2. 以下の関数を定義:
|
|
197
|
+
```zsh
|
|
198
|
+
function prompt_easy_worktree() {
|
|
199
|
+
if [[ -n $WT_SESSION_NAME ]]; then
|
|
200
|
+
p10k segment -f 255 -b 28 -i '🌳' -t "wt:$WT_SESSION_NAME"
|
|
201
|
+
fi
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
#### クリーンアップ (ショートカット: `cl`)
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
wt clean --merged
|
|
210
|
+
wt clean --closed # クローズされた (未マージ) PRのworktreeを削除
|
|
211
|
+
wt clean --days 30
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
### 設定
|
|
216
|
+
|
|
217
|
+
`.wt/config.toml` で挙動をカスタマイズできます:
|
|
218
|
+
|
|
219
|
+
```toml
|
|
220
|
+
worktrees_dir = ".worktrees" # worktree を作成するディレクトリ名
|
|
221
|
+
setup_files = [".env"] # 自動セットアップでコピーするファイル一覧
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
#### ローカル設定の上書き
|
|
225
|
+
|
|
226
|
+
`.wt/config.local.toml` を作成すると、設定をローカルでのみ上書きできます。このファイルは自動的に `.gitignore` に追加され、リポジトリにはコミットされません。
|
|
227
|
+
|
|
228
|
+
## Hook
|
|
229
|
+
|
|
230
|
+
`wt add` の後に自動実行されるスクリプトを記述できます。
|
|
231
|
+
テンプレートが `.wt/post-add` に作成されます。
|
|
232
|
+
|
|
233
|
+
## ライセンス
|
|
234
|
+
|
|
235
|
+
MIT License
|