Back to catalog

branchlet

by raghavpillai

Pending

Branchlet: A simple CLI Git worktree manager

360stars
19forks
TypeScript
Added 12/27/2025
Code Generationclaude-codecodegencursorgitvibe-codingworktrees
Installation
# Add to your Claude Code skills
git clone https://github.com/raghavpillai/branchlet
README.md

🌳 Branchlet

npm version license

A interactive CLI tool for creating and managing Git worktrees with an easy to use interface.

Branchlet Demo

Features

  • Quick Commands: Jump directly to specific actions via command line
  • Smart Configuration: Project-specific and global configuration support
  • File Management: Automatically copy configuration files to new worktrees
  • Post-Create Actions: Run custom commands after worktree creation

Installation

npm install -g branchlet

Quick Start

Run Branchlet in any Git repository:

branchlet

This opens an interactive menu where you can:

  • Create new worktrees
  • List existing worktrees
  • Delete worktrees
  • Configure settings

Commands

Interactive Menu (Default)

branchlet

Opens the main menu with all available options.

Direct Commands

branchlet create    # Go directly to worktree creation
branchlet list      # List all worktrees
branchlet delete    # Go directly to worktree deletion
branchlet settings  # Open settings menu

Options

branchlet --help     # Show help information
branchlet --version  # Show version number
branchlet -m create  # Set initial mode

Configuration

Branchlet looks for configuration files in this order:

  1. .branchlet.json in your repo's root (project-specific)
  2. ~/.branchlet/settings.json (global configuration)

Configuration Options

Create a .branchlet.json file in your project root or configure global settings:

{
  "worktreeCopyPatterns": [".env*", ".vscode/**"],
  "worktreeCopyIgnores": ["**/node_modules/**", "**/dist/**", "**/.git/**"],
  "worktreePathTemplate": "$BASE_PATH.worktree",
  "postCreateCmd": ["npm install", "npm run db:generate"],
  "terminalCommand": "code .",
  "deleteBranchWithWorktree": true
}

Configuration Fields

  • worktreeCopyPatterns: Files/directories to copy to new worktrees (supports glob patterns)

    • Default: [".env*", ".vscode/**"]
    • Examples: ["*.json", "config/**", ".env.local"]
  • worktreeCopyIgnores: Files/directories to exclude when copying (supports glob patterns)

    • Default: ["**/node_modules/**", "**/dist/**", "**/.git/**", "**/Thumbs.db", "**/.DS_Store"]
  • worktreePathTemplate: Template for worktree directory names

    • Default: "$BASE_PATH.worktree"
    • Variables: $BASE_PATH, $WORKTREE_PATH, $BRANCH_NAME, $SOURCE_BRANCH
    • Examples: "worktrees/$BRANCH_NAME", "$BASE_PATH-branches/$BRANCH_NAME"
  • postCreateCmd: Commands to run after creating a worktree. Runs in the new worktree directory.

    • Default: []
    • Examples: ["npm install"], ["pnpm install", "pnpm build"]
    • Variables supported in commands: $BASE_PATH, $WORKTREE_PATH, $BRANCH_NAME, `$...