Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

better-worktrees

A Bun-based TypeScript CLI for creating git worktrees and copying env files from the main worktree.

Install

This CLI uses Bun at runtime, so Bun must be installed on your machine before you use better-worktrees.

bun add -g better-worktrees

After installing, the command is available as better-worktrees.

Local development

bun install
bun link

That links your local project so you can test better-worktrees on your own machine while developing it.

Usage

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

Behavior

  • 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 HEAD by default, or from --base <ref>.
  • --env auto copies .env.local if it exists in the main worktree, otherwise .env.
  • --env all copies both .env.local and .env when they exist.
  • The default target path is a sibling folder named like <repo-name>-<branch>.

Runtime requirement

  • Bun is required to run this CLI, even after global installation.

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages