Name | easy-worktree JSON |
Version |
0.0.4
JSON |
| download |
home_page | None |
Summary | Git worktree を簡単に管理するための CLI ツール |
upload_time | 2025-10-09 12:16:06 |
maintainer | None |
docs_url | None |
author | igtm |
requires_python | >=3.11 |
license | MIT |
keywords |
cli
git
tool
worktree
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# easy-worktree
A CLI tool for easy Git worktree management
[日本語版 README](README_ja.md)
## Overview
`easy-worktree` simplifies git worktree management by establishing conventions, reducing the cognitive load of managing multiple working trees.
### Key Features
- **Standardized directory structure**: Creates a `_base/` directory within `WT_<repository_name>/` as the main repository
- **Easy worktree management**: Create and remove worktrees from `_base/`
- **Automatic branch updates**: Runs `git fetch --all` automatically when creating worktrees
## Installation
```bash
pip install easy-worktree
```
Or install the development version:
```bash
git clone https://github.com/igtm/easy-worktree.git
cd easy-worktree
pip install -e .
```
## Usage
### Clone a new repository
```bash
wt clone https://github.com/user/repo.git
```
This creates the following structure:
```
WT_repo/
_base/ # Main repository (typically don't modify directly)
```
### Convert an existing repository to easy-worktree structure
```bash
cd my-repo/
wt init
```
The current directory will be moved to `../WT_my-repo/_base/`.
### Add a worktree
```bash
cd WT_repo/
wt add feature-1
```
This creates the following structure:
```
WT_repo/
_base/
feature-1/ # Working worktree
```
You can also specify a branch name:
```bash
wt add feature-1 main
```
Create a worktree and set an alias at the same time:
```bash
wt add feature-123 --alias current # Create feature-123 and set 'current' alias
```
### List worktrees
```bash
wt list
```
### Remove a worktree
```bash
wt rm feature-1
# or
wt remove feature-1
```
### Initialization hook (post-add)
You can set up a script to run automatically after creating a worktree.
**Hook location**: `_base/.wt/post-add`
**Automatic creation**: When you run `wt clone` or `wt init`, a template file is automatically created at `_base/.wt/post-add` (won't overwrite if it already exists). Edit this file to describe your project-specific initialization process.
```bash
# Example: editing the hook script
vim WT_repo/_base/.wt/post-add
```
```bash
#!/bin/bash
set -e
echo "Initializing worktree: $WT_WORKTREE_NAME"
# Install npm packages
if [ -f package.json ]; then
npm install
fi
# Copy .env file
if [ -f "$WT_BASE_DIR/.env.example" ]; then
cp "$WT_BASE_DIR/.env.example" .env
fi
echo "Setup completed!"
```
Don't forget to make it executable:
```bash
chmod +x WT_repo/_base/.wt/post-add
```
**Available environment variables**:
- `WT_WORKTREE_PATH`: Path to the created worktree
- `WT_WORKTREE_NAME`: Name of the worktree
- `WT_BASE_DIR`: Path to the `_base/` directory
- `WT_BRANCH`: Branch name
- `WT_ACTION`: Action name (`add`)
The hook runs within the newly created worktree directory.
### List worktrees with details
```bash
wt list --verbose # Show creation time, last commit, status
wt list --sort age # Sort by creation time
wt list --sort name # Sort by name
```
### Clean up unused worktrees
Remove clean (no changes) worktrees in batch.
```bash
wt clean --dry-run # Preview what will be removed
wt clean --days 30 # Remove clean worktrees older than 30 days
wt clean --all # Remove all clean worktrees without confirmation
```
### Create worktree aliases
Create symbolic link shortcuts to frequently used worktrees.
```bash
wt alias current feature-123 # Create alias named 'current'
wt alias dev feature-xyz # Create alias named 'dev'
wt alias current hoge3 # Automatically override existing alias
wt alias --list # List all aliases
wt alias --remove current # Remove an alias
```
### Check status of all worktrees
View git status of all worktrees at once.
```bash
wt status # Show status of all worktrees
wt status --dirty # Show only worktrees with changes
wt status --short # Concise display
```
### Other git worktree commands
`wt` also supports other git worktree commands:
```bash
wt prune
wt lock <worktree>
wt unlock <worktree>
```
## Directory Structure
```
WT_<repository_name>/ # Project root directory
_base/ # Main git repository
feature-1/ # Worktree 1
bugfix-123/ # Worktree 2
...
```
You can run `wt` commands from `WT_<repository_name>/` or from within any worktree directory.
## Requirements
- Python >= 3.11
- Git
## License
MIT License
## Contributing
Issues and Pull Requests are welcome!
Raw data
{
"_id": null,
"home_page": null,
"name": "easy-worktree",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "cli, git, tool, worktree",
"author": "igtm",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/95/b2/b3e6cf36417d5eadc64438dc5ac449aaccfaa5799d865e02003fb966a1f1/easy_worktree-0.0.4.tar.gz",
"platform": null,
"description": "# easy-worktree\n\nA CLI tool for easy Git worktree management\n\n[\u65e5\u672c\u8a9e\u7248 README](README_ja.md)\n\n## Overview\n\n`easy-worktree` simplifies git worktree management by establishing conventions, reducing the cognitive load of managing multiple working trees.\n\n### Key Features\n\n- **Standardized directory structure**: Creates a `_base/` directory within `WT_<repository_name>/` as the main repository\n- **Easy worktree management**: Create and remove worktrees from `_base/`\n- **Automatic branch updates**: Runs `git fetch --all` automatically when creating worktrees\n\n## Installation\n\n```bash\npip install easy-worktree\n```\n\nOr install the development version:\n\n```bash\ngit clone https://github.com/igtm/easy-worktree.git\ncd easy-worktree\npip install -e .\n```\n\n## Usage\n\n### Clone a new repository\n\n```bash\nwt clone https://github.com/user/repo.git\n```\n\nThis creates the following structure:\n\n```\nWT_repo/\n _base/ # Main repository (typically don't modify directly)\n```\n\n### Convert an existing repository to easy-worktree structure\n\n```bash\ncd my-repo/\nwt init\n```\n\nThe current directory will be moved to `../WT_my-repo/_base/`.\n\n### Add a worktree\n\n```bash\ncd WT_repo/\nwt add feature-1\n```\n\nThis creates the following structure:\n\n```\nWT_repo/\n _base/\n feature-1/ # Working worktree\n```\n\nYou can also specify a branch name:\n\n```bash\nwt add feature-1 main\n```\n\nCreate a worktree and set an alias at the same time:\n\n```bash\nwt add feature-123 --alias current # Create feature-123 and set 'current' alias\n```\n\n### List worktrees\n\n```bash\nwt list\n```\n\n### Remove a worktree\n\n```bash\nwt rm feature-1\n# or\nwt remove feature-1\n```\n\n### Initialization hook (post-add)\n\nYou can set up a script to run automatically after creating a worktree.\n\n**Hook location**: `_base/.wt/post-add`\n\n**Automatic creation**: When you run `wt clone` or `wt init`, a template file is automatically created at `_base/.wt/post-add` (won't overwrite if it already exists). Edit this file to describe your project-specific initialization process.\n\n```bash\n# Example: editing the hook script\nvim WT_repo/_base/.wt/post-add\n```\n\n```bash\n#!/bin/bash\nset -e\n\necho \"Initializing worktree: $WT_WORKTREE_NAME\"\n\n# Install npm packages\nif [ -f package.json ]; then\n npm install\nfi\n\n# Copy .env file\nif [ -f \"$WT_BASE_DIR/.env.example\" ]; then\n cp \"$WT_BASE_DIR/.env.example\" .env\nfi\n\necho \"Setup completed!\"\n```\n\nDon't forget to make it executable:\n\n```bash\nchmod +x WT_repo/_base/.wt/post-add\n```\n\n**Available environment variables**:\n- `WT_WORKTREE_PATH`: Path to the created worktree\n- `WT_WORKTREE_NAME`: Name of the worktree\n- `WT_BASE_DIR`: Path to the `_base/` directory\n- `WT_BRANCH`: Branch name\n- `WT_ACTION`: Action name (`add`)\n\nThe hook runs within the newly created worktree directory.\n\n### List worktrees with details\n\n```bash\nwt list --verbose # Show creation time, last commit, status\nwt list --sort age # Sort by creation time\nwt list --sort name # Sort by name\n```\n\n### Clean up unused worktrees\n\nRemove clean (no changes) worktrees in batch.\n\n```bash\nwt clean --dry-run # Preview what will be removed\nwt clean --days 30 # Remove clean worktrees older than 30 days\nwt clean --all # Remove all clean worktrees without confirmation\n```\n\n### Create worktree aliases\n\nCreate symbolic link shortcuts to frequently used worktrees.\n\n```bash\nwt alias current feature-123 # Create alias named 'current'\nwt alias dev feature-xyz # Create alias named 'dev'\nwt alias current hoge3 # Automatically override existing alias\nwt alias --list # List all aliases\nwt alias --remove current # Remove an alias\n```\n\n### Check status of all worktrees\n\nView git status of all worktrees at once.\n\n```bash\nwt status # Show status of all worktrees\nwt status --dirty # Show only worktrees with changes\nwt status --short # Concise display\n```\n\n### Other git worktree commands\n\n`wt` also supports other git worktree commands:\n\n```bash\nwt prune\nwt lock <worktree>\nwt unlock <worktree>\n```\n\n## Directory Structure\n\n```\nWT_<repository_name>/ # Project root directory\n _base/ # Main git repository\n feature-1/ # Worktree 1\n bugfix-123/ # Worktree 2\n ...\n```\n\nYou can run `wt` commands from `WT_<repository_name>/` or from within any worktree directory.\n\n## Requirements\n\n- Python >= 3.11\n- Git\n\n## License\n\nMIT License\n\n## Contributing\n\nIssues and Pull Requests are welcome!\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Git worktree \u3092\u7c21\u5358\u306b\u7ba1\u7406\u3059\u308b\u305f\u3081\u306e CLI \u30c4\u30fc\u30eb",
"version": "0.0.4",
"project_urls": {
"Homepage": "https://github.com/igtm/easy-worktree",
"Issues": "https://github.com/igtm/easy-worktree/issues",
"Repository": "https://github.com/igtm/easy-worktree"
},
"split_keywords": [
"cli",
" git",
" tool",
" worktree"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4a6e18fc4f30f8fdeb361cd5d8fa11e20b3b52e639f1f1c81baff31e3cb4588a",
"md5": "c963e30bd5ff321bb689acef3207e1e0",
"sha256": "cff3c987ebe7756e2927c50c32eef733a1060862519fcb20a441a3ebff5751b6"
},
"downloads": -1,
"filename": "easy_worktree-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c963e30bd5ff321bb689acef3207e1e0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 11903,
"upload_time": "2025-10-09T12:16:05",
"upload_time_iso_8601": "2025-10-09T12:16:05.687944Z",
"url": "https://files.pythonhosted.org/packages/4a/6e/18fc4f30f8fdeb361cd5d8fa11e20b3b52e639f1f1c81baff31e3cb4588a/easy_worktree-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "95b2b3e6cf36417d5eadc64438dc5ac449aaccfaa5799d865e02003fb966a1f1",
"md5": "83321f665ac85d0d3e03bc2975e501f4",
"sha256": "ae7ed2ee9afcd54de850edb89faa6665e5fd4771c601d8e01b18fa16696016c7"
},
"downloads": -1,
"filename": "easy_worktree-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "83321f665ac85d0d3e03bc2975e501f4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 13856,
"upload_time": "2025-10-09T12:16:06",
"upload_time_iso_8601": "2025-10-09T12:16:06.737018Z",
"url": "https://files.pythonhosted.org/packages/95/b2/b3e6cf36417d5eadc64438dc5ac449aaccfaa5799d865e02003fb966a1f1/easy_worktree-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-09 12:16:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "igtm",
"github_project": "easy-worktree",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "easy-worktree"
}