Socket
Book a DemoInstallSign in
Socket

@mcadam/worktree

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mcadam/worktree

A CLI tool for managing Git worktrees across multiple repositories

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
6
-90.77%
Maintainers
1
Weekly downloads
ย 
Created
Source

๐ŸŒณ Worktree CLI

Transform your Git workflow with blazing-fast worktree management across multiple repositories โšก

npm version License: MIT TypeScript Node.js

๐ŸŽฏ Why Worktree CLI?

Stop juggling branches with git stash and git checkout. Stop losing your local changes. Stop waiting for dependency installs. Start working on multiple features simultaneously without the hassle.

# Old way ๐Ÿ˜ซ
git stash
git checkout feature-B
npm install
# ... where did my changes go?

# Worktree way ๐Ÿ˜Ž
worktree feature-B
# Done! New isolated workspace ready in seconds!

โœจ Features That Spark Joy

๐Ÿš€ Lightning-Fast Setup

One command to rule them all - create a worktree, copy env files, install dependencies, and open your IDE.

๐Ÿข Multi-Repository Management

Manage worktrees across your entire stack - frontend, backend, microservices - all from one place.

๐Ÿท๏ธ Smart Organization

Custom prefixes keep your worktrees organized (fe-feature, be-bugfix, api-hotfix).

๐ŸŽจ Beautiful CLI Experience

React-powered interactive UI with Ink - because terminals can be beautiful too.

๐Ÿ”„ GitHub Integration

See PR status instantly when gh CLI is installed - no API keys needed!

๐Ÿงน Bulk Operations

Select multiple worktrees with spacebar and delete them all at once. Spring cleaning made easy.

๐Ÿ“ฆ Installation

# npm
npm install -g worktree-cli

# pnpm (recommended)
pnpm add -g worktree-cli

# yarn
yarn global add worktree-cli

๐Ÿš€ Quick Start

1๏ธโƒฃ Initialize Your First Repository

cd your-awesome-project
worktree init

You'll be guided through a delightful setup:

๐Ÿ“ Repository name: frontend
๐Ÿท๏ธ Worktree prefix: fe-
๐Ÿ“ Base path: ../worktrees
๐Ÿ” Env file: .env.local
๐Ÿ“ฆ Install command: pnpm install
๐Ÿ’ป IDE command: cursor

2๏ธโƒฃ Create Your First Worktree

worktree feature/dark-mode

Watch the magic happen:

โœจ Creating worktree for branch: feature/dark-mode
๐Ÿ“ Location: ../worktrees/fe-feature-dark-mode
โœ“ Worktree created
โœ“ Copied .env.local
โœ“ Dependencies installed
โœ“ Opened in cursor

โœ… Ready for some epic code!

3๏ธโƒฃ Manage Your Worktrees

worktree list

Interactive UI shows all your worktrees:

โ”Œโ”€ Frontend (/Users/you/frontend) โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โ˜ fe-feature-auth    โœ“ remote ๐Ÿ”€ PR #23 โ”‚
โ”‚ โ˜ fe-dark-mode       โš ๏ธ local only      โ”‚
โ”‚ โ˜ fe-fix-header      โœ“ remote           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

[Space] Select  [Enter] Delete  [Q] Quit

๐ŸŽฎ Commands

worktree <branch> - Create Magic โœจ

Creates a new worktree with all the bells and whistles:

worktree feature/awesome-stuff
# Creates: ../worktrees/fe-feature-awesome-stuff
# Runs: pnpm install
# Copies: .env.local
# Opens: cursor

worktree list - See Everything ๐Ÿ‘€

Beautiful interactive list of all worktrees across all repositories:

  • Space - Select worktrees
  • Enter - Delete selected
  • Q - Quit

Status indicators:

  • โœ“ remote - Pushed to remote
  • ๐Ÿ”€ PR #X - Has an open pull request
  • โš ๏ธ local only - Not yet pushed

worktree init - Setup Paradise ๐Ÿ๏ธ

Interactive configuration for the current repository:

worktree init
# Answer a few questions and you're golden!

worktree config - Fine-Tune Everything โš™๏ธ

Manage global defaults and repository settings:

worktree config
# โ€ข View configuration
# โ€ข Edit defaults
# โ€ข Remove repositories

๐ŸŽฏ Real-World Workflow

The Full-Stack Developer's Dream

# Monday morning - Set up your repositories
cd ~/projects/frontend
worktree init
# prefix: fe-

cd ~/projects/backend
worktree init
# prefix: be-

cd ~/projects/mobile
worktree init
# prefix: mob-

# Start working on a feature across all repos
cd ~/projects/frontend
worktree feature/user-dashboard

cd ~/projects/backend
worktree feature/user-dashboard-api

cd ~/projects/mobile
worktree feature/user-dashboard-mobile

# See all your work
worktree list
# Shows all 3 worktrees across all repos! ๐ŸŽ‰

The Quick Fix Master

# Emergency hotfix needed!
worktree hotfix/critical-bug

# Fix the bug...
# Push to remote...
# Create PR...

# Clean up when done
worktree list
# Select the hotfix worktree
# Press Enter to delete
# โœ… Workspace cleaned up!

โš™๏ธ Configuration

Your config lives at ~/.worktreerc.json:

{
  "defaultBasePath": "../worktrees",
  "defaultInstallCommand": "pnpm install",
  "defaultIdeCommand": "cursor",
  "repos": {
    "/Users/you/frontend": {
      "name": "frontend",
      "prefix": "fe-",
      "basePath": "../worktrees",
      "envPath": ".env.local",
      "installCommand": "pnpm install && pnpm prepare",
      "ideCommand": "cursor"
    },
    "/Users/you/backend": {
      "name": "backend",
      "prefix": "be-",
      "envPath": ".env",
      "installCommand": "pnpm install && pnpm db:migrate"
    }
  }
}

๐Ÿ› ๏ธ Development

Want to contribute? Awesome! Here's how to get started:

# Clone the repo
git clone https://github.com/yourusername/worktree-cli.git
cd worktree-cli

# Install dependencies
pnpm install

# Development mode with hot reload
pnpm dev

# Build for production
pnpm build

# Test locally
npm link
worktree --version

Tech Stack

  • TypeScript - Type safety FTW
  • Ink - React for CLIs
  • Commander - CLI argument parsing
  • Zod - Runtime type validation
  • Biome - Fast formatting & linting

๐Ÿค Contributing

We love contributions! Whether it's:

  • ๐Ÿ› Bug reports
  • ๐Ÿ’ก Feature requests
  • ๐Ÿ“– Documentation improvements
  • ๐ŸŽจ UI/UX enhancements
  • ๐Ÿ”ง Code contributions

Check out our Contributing Guide to get started.

๐Ÿ“ Requirements

  • Node.js >= 18.0.0
  • Git (obviously!)
  • gh CLI (optional, for PR status)

๐ŸŽ‰ Success Stories

"Worktree CLI changed my life! I can finally work on multiple features without losing my mind!" - Happy Developer

"The prefix system is genius. My worktrees folder is finally organized!" - Organized Developer

"Being able to see PR status right in the terminal? Chef's kiss" - Efficient Developer

๐Ÿ“„ License

MIT ยฉ [Your Name]

Built with ๐Ÿ’™ by developers, for developers

Report Bug ยท Request Feature ยท Star on GitHub

๐ŸŒŸ Don't forget to star this repo if you find it useful! ๐ŸŒŸ

Keywords

git

FAQs

Package last updated on 25 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.