
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
git-worktree-cli
Advanced tools
A lightweight Python CLI tool to simplify Git worktree management.
wt makes working with Git worktrees effortless by providing an intuitive command-line interface for adding, listing, and removing worktrees. It automatically generates consistent paths and can optionally open new worktrees in your IDE or terminal.
../<root_folder_name>_<branch_name>Make sure you have uv installed:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Or with Homebrew
brew install uv
# Clone the repository
git clone https://github.com/yourusername/git-worktree-cli.git
cd git-worktree-cli
# Install dependencies
uv sync
# Activate the virtual environment
source .venv/bin/activate # On Unix/macOS
# .venv\Scripts\activate # On Windows
# Install globally with uv
uv tool install git-worktree-cli
# Or install from local source
uv tool install .
wt --version
Add a new worktree for a branch:
# Basic usage - adds worktree only
wt add feature-x
# Creates: ../git-worktree-cli_feature-x
# Add and open in VS Code
wt add feature-y --ide code
# Add and start Claude session
wt add feature-z --claude
# Add and open in default IDE (auto-detects: code, cursor, pycharm, subl, atom)
wt add feature-w --ide
Path Generation: Worktrees are created at ../<root_folder_name>_<branch_name>
Display all worktrees in the repository:
wt list
# Or use the alias:
wt ls
Example output:
PATH BRANCH COMMIT
------------------------------------------------------------------------------------------
/Users/user/projects/myproject main abc1234
/Users/user/projects/myproject_feature-x feature-x def5678
Remove a worktree:
# Remove a worktree
wt remove /path/to/worktree
# Or use the alias:
wt rm /path/to/worktree
# Force remove (even with uncommitted changes)
wt remove /path/to/worktree --force
The add command supports optional flags to perform actions after creating the worktree:
Adds the worktree without any additional action.
wt add feature-x
--ideAdds the worktree and opens it in an IDE.
# Specify IDE explicitly
wt add feature-x --ide code # VS Code
wt add feature-x --ide cursor # Cursor
wt add feature-x --ide pycharm # PyCharm
# Auto-detect IDE (tries: code, cursor, pycharm, subl, atom)
wt add feature-x --ide
--claudeAdds the worktree and starts a Claude Code session.
wt add feature-x --claude
Note: --ide and --claude are mutually exclusive.
# Add a new worktree for a feature branch and open in VS Code
wt add feature/auth-system --ide code
# Work on the feature...
cd ../myproject_feature/auth-system
# When done, remove the worktree
wt rm /path/to/myproject_feature/auth-system
# Add worktree for hotfix
wt add hotfix/urgent-bug
# Work on the fix in the new location
cd ../myproject_hotfix/urgent-bug
# After merging, clean up
wt remove ../myproject_hotfix/urgent-bug
wt list
# Or use the alias:
wt ls
--mode terminal on macOS)# Clone the repository
git clone https://github.com/yourusername/git-worktree-cli.git
cd git-worktree-cli
# Install all dependencies (including dev)
uv sync --all-extras
# Activate virtual environment
source .venv/bin/activate
# Run all tests
uv run pytest
# Run with verbose output
uv run pytest -v
# Run specific test file
uv run pytest tests/test_worktree.py -v
# Format code with black
uv run black wt/ tests/
# Lint with pylint
uv run pylint wt/ tests/ --disable=C0114,C0115,C0116,R0903 --max-line-length=120
git-worktree-cli/
├── wt/
│ ├── __init__.py # Package initialization
│ ├── __main__.py # Entry point for python -m wt
│ ├── cli.py # CLI commands and interface
│ ├── worktree.py # Core worktree operations
│ └── launchers.py # IDE and terminal launchers
├── tests/
│ ├── test_cli.py # CLI tests
│ ├── test_worktree.py # Worktree operation tests
│ └── test_launchers.py # Launcher tests
├── pyproject.toml # Project configuration
└── README.md # This file
Make sure you're running wt from within a Git repository.
Ensure the IDE executable is in your PATH:
which code # VS Code
which pycharm # PyCharm
Make sure iTerm2 is installed. Terminal integration currently only supports iTerm2 on macOS.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
This project was a way to use Claude Code for a real use-case, which was inspired by John Lindquists' worktree-cli.
FAQs
A lightweight Python CLI tool to simplify Git worktree management
We found that git-worktree-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.