Tooling around git worktrees to make managing multiple branches easier
Work on multiple branches simultaneously without stashing or switching. Never lose context switching between features. One repository, multiple working directories:
my-project/
├── main/ # Main branch
├── feature-123/ # Feature branch
└── bugfix-456/ # Bugfix branch
Each directory is independent. cd
to switch between branches.
git clone https://github.com/mikko-kohtala/git-worktree-cli.git
cd git-worktree-cli
cargo build --release && cargo install --path .
gwt completions install # Optional: tab completion
# Setup once per project
gwt init [email protected]:company/app.git
cd main
# Create branches instantly
gwt add feature/user-auth
gwt add hotfix/login-bug
# Switch contexts with cd (no stashing)
cd ../feature/user-auth # Work on feature
cd ../hotfix/login-bug # Fix urgent bug
cd ../feature/user-auth # Back to feature
# See all work with PR status
gwt list
# ┌───────────────────┬─────────────────────────────┐
# │ BRANCH │ PULL REQUEST │
# │ main │ - │
# │ feature/user-auth │ #42 (open) │
# │ hotfix/login-bug │ #41 (merged) │
# └───────────────────┴─────────────────────────────┘
# Clean up finished work
gwt remove hotfix/login-bug
gwt init <url>
- Setup project from repositorygwt add <branch>
- Create branch directorygwt list
- Show branches with PR statusgwt remove [branch]
- Delete branch directorygwt auth <provider>
- Setup GitHub/Bitbucket auth
Auto-run commands when creating/removing branches. Edit git-worktree-config.jsonc
:
{
"hooks": {
"postAdd": [
"npm install",
"npm run init"
]
}
}
Now gwt add feature/x
automatically installs dependencies.
Setup once to see PR status in gwt list
:
GitHub: gh auth login
Bitbucket: gwt auth bitbucket-cloud setup
Works with GitHub, Bitbucket Cloud, and Bitbucket Data Center.
- No stashing - Switch branches instantly with
cd
- No losing context - Each branch keeps its state
- Parallel work - Handle urgent fixes without disrupting features
- Automated setup - Dependencies install automatically via hooks
- PR visibility - See all pull requests from terminal
- Git 2.5+
- Rust 1.70+ (for building)
MIT License • Contributions welcome