wkt is a Go-based CLI tool that simplifies Git worktree workflows by providing convenient commands for cloning, adding, removing, and managing worktrees, as well as creating branches from GitHub issues.
- Clone repositories as bare with an adjustable directory structure
- Add new worktrees for local branches
- Add worktrees for remote branches via fzf selection
- Remove and clean up worktrees with branch deletion
- Create new branches from GitHub issues using GitHub CLI and fzf
- (Experimental) Merge or rebase worktrees against a target branch
- Go (>= 1.16)
- Git
- fzf (https://github.com/junegunn/fzf)
- GitHub CLI (
gh) for theissuecommand
-
Clone this repository:
git clone https://github.com/artsbentley/wkt.git cd wkt -
Build the binary:
just build # or go build -o bin/wkt ./cmd/wkt/main.go -
(Optional) Copy to a directory in your PATH:
cp ./bin/wkt /usr/local/bin/wkt
Run wkt --help to see available commands:
wkt --help-
wkt clone <repo-url> [--tree]
Clone a repository as a bare repo under a.baredirectory.
--tree, -t: create worktrees for all branches. -
wkt add <branch-name> [--base <base>] [--upstream]
Create a new worktree sibling directory with a branch based on<base>(defaultmain).
--upstream, -u: set upstream and push new branch. -
wkt add-remote
Select a remote branch viafzfto add as a worktree. -
wkt remove
Select an existing worktree viafzf, remove it, delete remote branch, and prune. -
wkt issue
Create a new worktree from a GitHub issue: choose an issue viafzf, branch offmain, push. -
wkt merge [--target <branch>] [--rebase] [--push]
(Experimental) Merge or rebase the current worktree onto<target>(defaultmain).
--rebase, -r: use rebase.
--push, -p: push after merge/rebase.
# Clone repo and all branches as worktrees
wkt clone https://github.com/user/repo.git --tree
# Create a feature worktree from main
wkt add feature/cool-feature -b main
# Add a remote branch via fzf
wkt add-remote
# Remove a worktree and its branch
wkt remove
# Create a worktree from GitHub issue 42
wkt issue
# Merge current worktree with main and push
wkt merge --target main --pushContributions are welcome! Feel free to open issues or pull requests.