easy-worktree 0.0.5__tar.gz → 0.1.0__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.0.5 → easy_worktree-0.1.0}/.gitignore +2 -0
- easy_worktree-0.1.0/PKG-INFO +180 -0
- easy_worktree-0.1.0/README.md +158 -0
- easy_worktree-0.1.0/README_ja.md +155 -0
- easy_worktree-0.1.0/easy_worktree/__init__.py +1625 -0
- easy_worktree-0.1.0/easy_worktree/__init__.py_snippet_helper +18 -0
- easy_worktree-0.1.0/hero.png +0 -0
- {easy_worktree-0.0.5 → easy_worktree-0.1.0}/pyproject.toml +3 -3
- easy_worktree-0.1.0/tests/test_integration.py +493 -0
- easy_worktree-0.0.5/PKG-INFO +0 -237
- easy_worktree-0.0.5/README.md +0 -216
- easy_worktree-0.0.5/README_ja.md +0 -214
- easy_worktree-0.0.5/easy_worktree/__init__.py +0 -1036
- {easy_worktree-0.0.5 → easy_worktree-0.1.0}/.python-version +0 -0
- {easy_worktree-0.0.5 → easy_worktree-0.1.0}/DEPLOY.md +0 -0
- {easy_worktree-0.0.5 → easy_worktree-0.1.0}/LICENSE +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: easy-worktree
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Git worktree を簡単に管理するための CLI ツール
|
|
5
|
+
Project-URL: Homepage, https://github.com/igtm/easy-worktree
|
|
6
|
+
Project-URL: Repository, https://github.com/igtm/easy-worktree
|
|
7
|
+
Project-URL: Issues, https://github.com/igtm/easy-worktree/issues
|
|
8
|
+
Author: igtm
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: cli,git,tool,worktree
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: toml
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
# easy-worktree
|
|
26
|
+
|
|
27
|
+
A CLI tool for easy Git worktree management.
|
|
28
|
+
|
|
29
|
+
[日本語版 README](README_ja.md)
|
|
30
|
+
|
|
31
|
+
## Overview
|
|
32
|
+
|
|
33
|
+
`easy-worktree` simplifies git worktree management.
|
|
34
|
+
It keeps the root of your git repository as your primary working area (main), while managing other worktrees in a subdirectory (default: `.worktrees/`).
|
|
35
|
+
|
|
36
|
+
### Key Features
|
|
37
|
+
|
|
38
|
+
- **Standardized directory structure**: Worktrees are created in a `.worktrees/` subdirectory (configurable). Keeps your root directory clean.
|
|
39
|
+
- **Auto Sync**: Automatically sync files ignored by git (like `.env`) from the root to each worktree.
|
|
40
|
+
- **Clear Status**: `wt list` shows worktree branches, their status (clean/dirty), and associated GitHub PRs in a beautiful table.
|
|
41
|
+
- **Smart Cleanup**: Easily batch remove merged branches or old unused worktrees.
|
|
42
|
+
- **Two-letter shortcuts**: Fast execution with shortcuts like `ad`, `ls`, `st`, `sy`, `cl`.
|
|
43
|
+
|
|
44
|
+
## Prerequisites
|
|
45
|
+
|
|
46
|
+
`easy-worktree` requires the following:
|
|
47
|
+
|
|
48
|
+
- **Git**: 2.34 or higher recommended.
|
|
49
|
+
- **GitHub CLI (gh)**: Required for PR features (`wt list --pr`, `wt pr add`, `wt clean --merged`). [Installation guide](https://cli.github.com/).
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install easy-worktree
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Or install the development version:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git clone https://github.com/igtm/easy-worktree.git
|
|
61
|
+
cd easy-worktree
|
|
62
|
+
pip install -e .
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
### Getting Started
|
|
68
|
+
|
|
69
|
+
#### Clone a new repository
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
wt clone https://github.com/user/repo.git
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
This clones the repository and initializes `easy-worktree` configuration.
|
|
76
|
+
|
|
77
|
+
#### Initialize an existing repository
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
cd my-repo/
|
|
81
|
+
wt init
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Initializes `easy-worktree` in the current repository. Your main repository stays at the project root.
|
|
85
|
+
|
|
86
|
+
### Managing Worktrees
|
|
87
|
+
|
|
88
|
+
#### Add a worktree (shortcut: `ad`)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
wt add feature-1
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This creates the following structure:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
my-repo/ (main)
|
|
98
|
+
.worktrees/
|
|
99
|
+
feature-1/ # Your new worktree
|
|
100
|
+
.wt/
|
|
101
|
+
...
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
You can also specify a base branch:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
wt add feature-1 main
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### List worktrees
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
wt list
|
|
114
|
+
wt list --pr # Show PR information
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
#### Stash and Move (shortcut: `st`)
|
|
119
|
+
|
|
120
|
+
Quickly stash your current changes and move them to a new worktree.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
wt stash feature-2
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### PR Management
|
|
127
|
+
|
|
128
|
+
Fetch a PR and create a worktree for it. (Requires `gh` CLI)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
wt pr add 123 # Fetches PR #123 and creates 'pr@123' worktree
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### Remove a worktree
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
wt rm feature-1
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Removes the worktree and its directory.
|
|
141
|
+
|
|
142
|
+
### Useful Features
|
|
143
|
+
|
|
144
|
+
#### Sync configuration files (shortcut: `sy`)
|
|
145
|
+
|
|
146
|
+
Sync files like `.env` that are not in git from the root to your worktrees.
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
wt sync .env
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
#### Cleanup (shortcut: `cl`)
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
wt clean --merged
|
|
157
|
+
wt clean --closed # Remove worktrees for closed (unmerged) PRs
|
|
158
|
+
wt clean --days 30
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
### Configuration
|
|
164
|
+
|
|
165
|
+
Customize behavior in `.wt/config.toml`:
|
|
166
|
+
|
|
167
|
+
```toml
|
|
168
|
+
worktrees_dir = ".worktrees" # Directory where worktrees are created
|
|
169
|
+
sync_files = [".env"] # Files to auto-sync
|
|
170
|
+
auto_copy_on_add = true # Enable auto-sync on add
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Hooks
|
|
174
|
+
|
|
175
|
+
You can define scripts to run automatically after `wt add`.
|
|
176
|
+
Templates are created in `.wt/post-add` upon initialization.
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
|
+
MIT License
|
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
- **Standardized directory structure**: Worktrees are created in a `.worktrees/` subdirectory (configurable). Keeps your root directory clean.
|
|
17
|
+
- **Auto Sync**: Automatically sync files ignored by git (like `.env`) from the root to 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`, `st`, `sy`, `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
|
+
#### List worktrees
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
wt list
|
|
92
|
+
wt list --pr # Show PR information
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
#### Stash and Move (shortcut: `st`)
|
|
97
|
+
|
|
98
|
+
Quickly stash your current changes and move them to a new worktree.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
wt stash feature-2
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### PR Management
|
|
105
|
+
|
|
106
|
+
Fetch a PR and create a worktree for it. (Requires `gh` CLI)
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
wt pr add 123 # Fetches PR #123 and creates 'pr@123' worktree
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### Remove a worktree
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
wt rm feature-1
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Removes the worktree and its directory.
|
|
119
|
+
|
|
120
|
+
### Useful Features
|
|
121
|
+
|
|
122
|
+
#### Sync configuration files (shortcut: `sy`)
|
|
123
|
+
|
|
124
|
+
Sync files like `.env` that are not in git from the root to your worktrees.
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
wt sync .env
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
#### Cleanup (shortcut: `cl`)
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
wt clean --merged
|
|
135
|
+
wt clean --closed # Remove worktrees for closed (unmerged) PRs
|
|
136
|
+
wt clean --days 30
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
### Configuration
|
|
142
|
+
|
|
143
|
+
Customize behavior in `.wt/config.toml`:
|
|
144
|
+
|
|
145
|
+
```toml
|
|
146
|
+
worktrees_dir = ".worktrees" # Directory where worktrees are created
|
|
147
|
+
sync_files = [".env"] # Files to auto-sync
|
|
148
|
+
auto_copy_on_add = true # Enable auto-sync on add
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Hooks
|
|
152
|
+
|
|
153
|
+
You can define scripts to run automatically after `wt add`.
|
|
154
|
+
Templates are created in `.wt/post-add` upon initialization.
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT License
|
|
@@ -0,0 +1,155 @@
|
|
|
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
|
+
- **整理されたディレクトリ構成**: worktree は `.worktrees/` ディレクトリ(設定で変更可能)の下に作成されます。ルートディレクトリが散らかりません。
|
|
15
|
+
- **自動同期**: `.env` などの git 管理外ファイルを、ルートから各 worktree へ自動的にコピー・同期できます。
|
|
16
|
+
- **わかりやすい一覧表示**: `wt list` で worktree の一覧、ブランチ、状態(clean/dirty)、GitHub PR 情報を美しく表示します。
|
|
17
|
+
- **スマートなクリーンアップ**: マージ済みのブランチや古い worktree を簡単に削除できるようになります。
|
|
18
|
+
- **2文字ショートカット**: `ad`, `ls`, `st`, `sy`, `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
|
+
#### 一覧を表示 (ショートカット: `ls`)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
wt list
|
|
90
|
+
wt ls --pr # GitHub の PR 情報もあわせて表示
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
#### スタッシュと移動 (ショートカット: `st`)
|
|
95
|
+
|
|
96
|
+
現在の変更をスタッシュし、そのまま新しい worktree を作成して移動します。
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
wt stash feature-2
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
#### PR 管理
|
|
103
|
+
|
|
104
|
+
GitHub の PR を取得して worktree を作成します(`gh` CLI が必要です)。
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
wt pr add 123 # PR #123 を取得し 'pr@123' という名前で worktree を作成
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### 削除
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
wt rm feature-1
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
ディレクトリごと worktree を削除します。
|
|
117
|
+
|
|
118
|
+
### 便利な機能
|
|
119
|
+
|
|
120
|
+
#### 設定ファイルの同期 (ショートカット: `sy`)
|
|
121
|
+
|
|
122
|
+
`.env` ファイルなどの git 管理外ファイルを、ルートから worktree に手動で同期します。
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
wt sync .env
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
#### クリーンアップ (ショートカット: `cl`)
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
wt clean --merged
|
|
133
|
+
wt clean --closed # クローズされた (未マージ) PRのworktreeを削除
|
|
134
|
+
wt clean --days 30
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
### 設定
|
|
139
|
+
|
|
140
|
+
`.wt/config.toml` で挙動をカスタマイズできます:
|
|
141
|
+
|
|
142
|
+
```toml
|
|
143
|
+
worktrees_dir = ".worktrees" # worktree を作成するディレクトリ名
|
|
144
|
+
sync_files = [".env"] # 自動同期するファイル一覧
|
|
145
|
+
auto_copy_on_add = true # wt add 時にファイルを自動コピーするか
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Hook
|
|
149
|
+
|
|
150
|
+
`wt add` の後に自動実行されるスクリプトを記述できます。
|
|
151
|
+
テンプレートが `.wt/post-add` に作成されます。
|
|
152
|
+
|
|
153
|
+
## ライセンス
|
|
154
|
+
|
|
155
|
+
MIT License
|