A simple wrapper around git worktree that makes managing Git worktrees effortless.
- 🚀 Simple commands to create worktrees as sibling directories
- 📁 Automatically copies all
.env*anddev.varsfiles (including nested ones) - 🔄 Sanitizes branch names (replaces
/with-for directory names) - 📋 List all worktrees
- 🗑️ Easy worktree removal
npm install -g easy-worktree- Node.js >= 14
- Git with worktree support
ew <branch_name>Creates a worktree at ../<branch_name> for the existing branch. Branch names with / are converted to - for the directory name.
Example:
ew feature/new-ui
# Creates worktree at ../feature-new-ui for branch feature/new-uiew -b <branch_name>Creates a new branch and worktree at ../<branch_name>.
Example:
ew -b feature/api-update
# Creates new branch feature/api-update and worktree at ../feature-api-updateew listShows all worktrees in the repository.
ew remove <worktree_path>Removes the specified worktree.
Example:
ew remove ../feature-new-ui- Creates a git worktree as a sibling directory (
../) - Sanitizes branch names by replacing
/with-for directory names - Recursively copies all
.env*anddev.varsfiles from the current directory to the new worktree - Preserves directory structure when copying environment files
The tool automatically copies:
- All files matching
.env*pattern (e.g.,.env,.env.local,.env.production) - All
dev.varsfiles - Nested environment files in subdirectories
If no environment files are found, the tool continues without error.
Git worktrees are powerful but can be tedious to set up, especially when you need to:
- Remember the exact syntax
- Copy configuration files
- Handle branch name sanitization
ew automates all of this, making worktree management as simple as possible.
MIT