Skip to content

raphaelluethy/worktree-create

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wtc - Worktree Create

A CLI tool for quickly creating git worktrees with sensible defaults.

Installation

cargo install --path .

Usage

Run wtc from within any git repository:

wtc

The tool will:

  1. Prompt for a branch name - Enter the name for your new branch (e.g., feature/my-feature)
  2. Handle uncommitted changes - If you have uncommitted changes, choose whether to transfer them to the new worktree
  3. Create the worktree - Automatically creates it at ~/worktrees/{repo-name}/{branch-name}
  4. Copy environment files - All .env* files are copied to the new worktree

Example

$ wtc
Branch name: feature/auth
You have uncommitted changes. Transfer them to the new worktree? [Y/n] y
Stashing changes...
Creating worktree at /Users/you/worktrees/my-project/feature-auth...
Copied .env
Copied .env.local
Applying stashed changes to new worktree...

Worktree created successfully!
Path: /Users/you/worktrees/my-project/feature-auth

To switch to the new worktree, run:
  cd /Users/you/worktrees/my-project/feature-auth

Features

  • Branch name validation - Prevents empty names and spaces
  • Automatic path generation - Converts feature/foo to feature-foo for the folder name
  • Change transfer - Safely moves uncommitted work using git stash
  • Environment file copying - Keeps your local configuration in the new worktree

Requirements

  • Git
  • Rust (for building)

About

A tool to easily create new worktrees with .env copy support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages