branchlet

作者 raghavpillai已验证

Branchlet: A simple CLI Git worktree manager

494
Stars
26
Forks
TypeScript
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/raghavpillai/branchlet

快速入门

使用 branchlet 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

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

Non-Interactive (Scriptable) CLI

Pass flags to skip the interactive prompts entirely. The three core concepts map directly to flags:

FlagDescription
-n, --name <name>Worktree directory name
-s, --source <branch>Source branch to create from
-b, --branch <branch>New branch name (defaults to -n when omitted)
# Create a worktree — new branch defaults to the worktree name
branchlet create -n my-feature -s main

# Create a worktree with an explicit branch name different from the directory
branchlet create -n ticket-3121-backend -s main -b feature/ticket-3121

# Create multiple sibling worktrees from the same source branch
# (each gets its own branch, so there's no checkout conflict)
branchlet create -n digit3121-backend  -s main -b feat/digit3121-backend
branchlet create -n digit3121-frontend -s main -b feat/digit3121-frontend

# List worktrees as JSON
branchlet list --json

# Delete a worktree by name
branchlet delete -n my-feature

# Force-delete a worktree by path
branchlet delete -p /path/to/worktree -f

Successful create output:

/path/to/worktree
  source: main
  branch: my-feature

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:

{
  "$schema": "https://raw.githubusercontent.com/raghavpillai/branchlet/main/schema.json",
  "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, $SOURCE_BRANCH
  • terminalCommand: Command to open terminal/editor in the new worktree. Runs in the new worktree directory.

    • Default: ""
    • Examples: "code .", "cursor .", "zed ."
  • deleteBranchWithWorktree: Whether to also delete the associated git branch when deleting a worktree

    • Default: false
    • When enabled, deleting a worktree will also delete its branch (with safety checks)
    • Shows warnings for branches with unpushed commits or uncommitted changes

Template Variables

Available in worktreePathTemplate, postCreateCmd, and terminalCommand:

  • $BASE_PATH: Base name of your repository
  • $WORKTREE_PATH: Full path to the new worktree
  • $BRANCH_NAME: Name of the new branch
  • $SOURCE_BRANCH: Name of the source branch

Usage Examples

Basic Workflow

  1. Navigate to your Git repository

    cd my-project
    
  2. Start Branchlet

    branchlet
    
  3. Create a worktree

    • Select "Create new worktree"
    • Enter directory name (e.g., feature-auth)
    • Choose source branch (e.g., main)
    • Enter new branch name (e.g., feature/authentication)
    • Confirm creation

Project-Specific Configuration

Create .branchlet.json in your project:

{
  "$schema": "https://raw.githubusercontent.com/raghavpillai/branchlet/main/schema.json",
  "worktreeCopyPatterns": [
    ".env.local",
    ".vscode/**",
    "package.json",
    "tsconfig.json"
  ],
  "worktreePathTemplate": "worktrees/$BRANCH_NAME",
  "postCreateCmd": [
    "npm install",
    "npm run db:populate"
  ],
  "terminalCommand": "code .",
  "deleteBranchWithWorktree": true
}

Requirements

  • Node.js 20.0.0 or higher
  • Git installed and available in PATH
  • Operating system: macOS, Linux, or Windows

License

MIT

常见问题

What is branchlet?

branchlet is an open-source code generation skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by raghavpillai. Branchlet: A simple CLI Git worktree manager. It has 494 GitHub stars.

Is branchlet safe to use?

Yes. branchlet passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install branchlet?

Clone the repository with "git clone https://github.com/raghavpillai/branchlet" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is branchlet written in?

branchlet is primarily written in TypeScript. It is open-source under raghavpillai on GitHub, so you can review or fork the full source.

Are there alternatives to branchlet?

Yes. SkillsLLM lists many other Code Generation skills you can browse and compare side by side. Open the Code Generation category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh branchlet against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

figwright

by awdr74100

Free, two-way Figma MCP server. Turn designs into framework-aware code, and push code back to the canvas. Works with Claude Code, Cursor, Codex, and any MCP client.

56631TypeScript
代码生成
查看详情

claude-paper

by alaliqing

📚 Claude Code plugin that automates research papers study with automatic material generation, code demonstrations, and interactive web viewer.

25322Vue
代码生成
查看详情

kodit

by helixml

👩‍💻 MCP server to index external repositories

12213Go
代码生成
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情