A dead-simple CLI that wraps git worktree so you can manage worktrees without remembering paths or flags.
git wt add feature-login # create a worktree
git wt list # see all worktrees
git wt remove feature-login # clean up
All worktrees live inside a .worktrees/ folder in your repo — automatically created and git-ignored.
my-project/
├── src/
├── .worktrees/
│ ├── feature-login/
│ └── feature-payment/
└── ...
git worktree is powerful but verbose. You have to specify full paths, remember to create directories, and manage cleanup yourself. simple-git-worktree reduces all of that to one short command: git wt.
| Command | Description |
|---|---|
git wt add <branch> [base] [--go] |
Create a worktree from current branch. --go outputs path for cd |
git wt list [--path] |
List all worktrees (names only; --path also shows paths) |
git wt remove <branch> |
Remove a worktree |
git wt prune |
Clean up stale worktree references |
git wt path <branch> |
Print the absolute path of a worktree |
git wt root |
Print the main repository root path |
git wt help |
Show help |
git wt version |
Show version |
curl -sL https://raw.githubusercontent.com/silasvasconcelos/simple-git-worktreee/main/install.sh | bashirm https://raw.githubusercontent.com/silasvasconcelos/simple-git-worktreee/main/install.ps1 | iexbrew tap silasvasconcelos/tap
brew install simple-git-worktreescoop bucket add silasvasconcelos https://github.com/silasvasconcelos/scoop-bucket
scoop install simple-git-worktreegit clone https://github.com/silasvasconcelos/simple-git-worktreee.git
cd simple-git-worktreee
chmod +x bin/git-wt
sudo cp bin/git-wt /usr/local/bin/
git config --global alias.wt '!git-wt'git clone https://github.com/silasvasconcelos/simple-git-worktreee.git
Copy-Item simple-git-worktreee\bin\git-wt "$env:LOCALAPPDATA\Programs\git-wt\git-wt"
git config --global alias.wt "!git-wt"Make sure
$env:LOCALAPPDATA\Programs\git-wtis in yourPATH.
cd my-project
git wt add feature-login
# ==> created .worktrees/
# ==> fetching from origin…
# ==> creating worktree for 'feature-login' based on 'develop'…
# ✔ worktree created at .worktrees/feature-login
cd .worktrees/feature-login
# You now have a full checkout — run tests, edit code, etc.cd "$(git wt add feature-login --go)"
# ==> creating worktree for 'feature-login' based on 'develop'…
# ✔ worktree created at .worktrees/feature-login
# You're now inside .worktrees/feature-loginTip: Add a shell function to your
.bashrc/.zshrcfor even less typing:gwt() { cd "$(git wt add "$@" --go)"; }Then just:
gwt feature-login
git wt add feature-payment maingit wt list
# main
# feature-loginPass --path to also see the absolute path of each worktree:
git wt list --path
# main /Users/you/my-project
# feature-login /Users/you/my-project/.worktrees/feature-logincode "$(git wt path feature-login)"git wt remove feature-login
# ==> removing worktree 'feature-login'…
# ✔ worktree 'feature-login' removed# From any worktree, return to the main project directory
cd "$(git wt root)"This works from anywhere — inside a worktree, a subdirectory, or the main repo itself. It always resolves to the original project root.
git wt pruneYou can run custom commands before and after worktree operations by creating a .git-wtrc file in your repository root.
Create a .git-wtrc file with key = command pairs:
# .git-wtrc — hook configuration for git-wt
# Runs before creating a worktree
pre-add = echo "Setting up $GIT_WT_BRANCH…"
# Runs after creating a worktree (e.g. install dependencies)
post-add = cd $GIT_WT_PATH && npm install
# Runs before removing a worktree
pre-remove = echo "Cleaning up $GIT_WT_BRANCH…"
# Runs after removing a worktree
post-remove = echo "Done removing $GIT_WT_BRANCH"| Hook | Trigger |
|---|---|
pre-add |
Before worktree creation |
post-add |
After worktree creation |
pre-remove |
Before worktree removal |
post-remove |
After worktree removal |
Each hook receives these environment variables:
| Variable | Description | Available in |
|---|---|---|
GIT_WT_BRANCH |
Branch name | All hooks |
GIT_WT_PATH |
Absolute path of the worktree | All hooks |
GIT_WT_ROOT |
Repository root path | All hooks |
GIT_WT_BASE |
Base branch name | pre-add, post-add |
Install dependencies after creating a worktree:
post-add = cd $GIT_WT_PATH && npm installRun a Python setup script:
post-add = python3 ./scripts/setup-worktree.pyUse a Ruby script for cleanup:
post-remove = ruby ./scripts/cleanup.rbBackup before removal:
pre-remove = tar czf "/tmp/${GIT_WT_BRANCH}-backup.tar.gz" "$GIT_WT_PATH"Chain multiple commands:
post-add = cd $GIT_WT_PATH && cp ../.env.example .env && npm install && npm run db:migrateNote: A failing
pre-*hook aborts the operation. A failingpost-*hook logs a warning but does not roll back.
# 1. Start a hotfix — jump straight into it with --go
cd "$(git wt add hotfix-auth --go)"
# 2. Fix the bug in the hotfix worktree
vim src/auth.js
git add -A && git commit -m "fix: auth token expiry"
git push origin hotfix-auth
# 3. Go back to main project root — your feature branch is untouched
cd "$(git wt root)"
# 4. Clean up after the hotfix is merged
git wt remove hotfix-auth
git wt prunemkdir -p simple-git-worktree_1.0.0/usr/local/bin
cp bin/git-wt simple-git-worktree_1.0.0/usr/local/bin/
mkdir -p simple-git-worktree_1.0.0/DEBIAN
cat > simple-git-worktree_1.0.0/DEBIAN/control <<EOF
Package: simple-git-worktree
Version: 1.0.0
Section: vcs
Priority: optional
Architecture: all
Depends: git
Maintainer: Silas Vasconcelos
Description: Simple git worktree manager
EOF
dpkg-deb --build simple-git-worktree_1.0.0# Linux / macOS
sudo rm /usr/local/bin/git-wt
git config --global --unset alias.wt
# Windows (PowerShell)
Remove-Item "$env:LOCALAPPDATA\Programs\git-wt" -Recurse -Force
git config --global --unset alias.wt- Fork the repo
- Create a feature branch:
git checkout -b my-feature - Commit your changes:
git commit -m "feat: add my feature" - Push:
git push origin my-feature - Open a Pull Request
Please follow Conventional Commits for commit messages.