A Bun-based TypeScript CLI for creating git worktrees and copying env files from the main worktree.
This CLI uses Bun at runtime, so Bun must be installed on your machine before you use better-worktrees.
bun add -g better-worktreesAfter installing, the command is available as better-worktrees.
bun install
bun linkThat links your local project so you can test better-worktrees on your own machine while developing it.
better-worktrees <branch> [target-path] [--base <ref>] [--env <mode>]
better-worktrees create <branch> [target-path] [--base <ref>] [--env <mode>]Examples:
better-worktrees feature/login
better-worktrees create feature/login ../login-worktree
better-worktrees fix/api ../wt/api-fix --base main --env all- You can run the command from any folder inside a git repository.
- If the branch already exists locally, the CLI creates a worktree for that branch.
- If the branch does not exist, the CLI creates it from
HEADby default, or from--base <ref>. --env autocopies.env.localif it exists in the main worktree, otherwise.env.--env allcopies both.env.localand.envwhen they exist.- The default target path is a sibling folder named like
<repo-name>-<branch>.
- Bun is required to run this CLI, even after global installation.