branchyard
v1.4.0
Published
branchyard — Your shipyard for parallel development workflows. Maintain your digital yard with clean branches, productive workflows, and AI-era readiness.
Downloads
68
Maintainers
Readme
⚓ branchyard
Your shipyard for parallel development workflows. AI-era ready.
A developer’s repo is their yard and their pride. Everyone keeps their yards manicured.
branchyard gives you the tools to maintain your digital yard — keeping your branches clean, your workflow productive, and your development environment perfectly organized.
❓ Why branchyard?
Parallel development is powerful but messy with raw git worktree:
- Switching branches constantly breaks focus
- Running multiple features in parallel is error-prone
- Managing worktrees manually is tedious and risky
branchyard solves this by:
- Automating safe worktree creation/removal
- Managing multiple editors and sessions
- Adding safety checks, dry-run mode, and fun touches
- Keeping everything in one place — no hidden docs, no guesswork
🌱 Project Philosophy
branchyard is built on three principles:
Be Playful We believe tools should have personality. From ASCII Oprah to the yard pride story, branchyard reflects the people who build it.
Be Clear Every feature, every flag, every capability is documented here in the README. No hidden features, no buried docs — everything you need is in one place.
Empower the User Whether branchyard is right for you or not, you’ll know after reading this README. Our goal is to give you the best possible shot at making the right choice for your workflow.
🖥 System Requirements
branchyard works on Windows, macOS, and Linux.
Required
- Bun 1.3 or newer
- Git — must be installed and available in your
system
PATH. If Git is missing, branchyard will exit with a clear error.
Bun 1.3 is the supported baseline. Development and CI track the current latest stable Bun release on Windows, macOS, and Linux; older Bun releases, including Bun 1.0, are not supported.
Optional (for --open flag)
- Editor CLI command installed and available in
PATH:- VS Code →
code - Cursor →
cursor - Windsurf →
windsurf - Trae →
trae - Zed →
zedIf the selected editor CLI is missing, branchyard will exit with a clear error.
- VS Code →
Notes
- On Windows, you can use branchyard from:
- PowerShell
- Command Prompt
- Git Bash
- On macOS/Linux, any modern terminal will work.
- ASCII art Easter eggs (like Oprah) require a UTF-8 capable terminal (most modern terminals support this by default).
✨ Features
Worktree Management
- Create multiple worktrees from any base branch
- Remove worktrees safely (with dry-run mode)
- Bulk remove multiple worktrees at once
- List active worktrees with branch, path, last commit, and age
Safety First
- Pre-flight checks:
- Git installed
- Inside a Git repo
- Show current directory, repo root, and branch
- Warn if not in repo root (with
--allow-subdirfor monorepos)
- Dry-run mode (
--dry-run) to preview changes - Explicit force mode (
--force) for workspace replacement and dirty removal
Interactive Mode
- Guided prompts for creating, removing, listing, and restoring
- Multi-select worktree removal
- Editor selection (VS Code, Cursor, Windsurf, Trae, Zed)
- Auto-prompt to save setup as a named session
Multi-Editor Support
- Open worktrees in your preferred editor
- Save default editor in
~/.branchyardrc - Easily extendable for future editors
Named Sessions
- Save a setup with
branchyard save-session <name> - Restore with
branchyard restore [name](auto-recreates missing worktrees) - List sessions with
branchyard sessions - Delete sessions with
branchyard delete-session <name>
Workspace Automation
- Generates
.code-workspaceentries for the requested managed worktrees - Merges with a custom template from
~/.branchyardrc - Supports settings, extensions, and more
📦 Installation
Using Bun (recommended)
bun install -g branchyardFrom source
git clone https://github.com/SivaramPg/branchyard.git
cd branchyard
bun link🚀 Usage
Interactive Mode
branchyardGuided prompts for creating, removing, listing, and restoring worktrees. Pre-flight check runs first to show:
- Current directory
- Repo root
- Current branch
- Warn if not in repo root
Create Worktrees
branchyard agent-factory upgrades-marketplace --base develop --open- Creates
agent-factoryandupgrades-marketplacefromdevelop - Creates requested worktrees sequentially under
.worktrees/ - Reuses an existing branch only after confirmation
- Refuses to replace
parallel-dev.code-workspaceunless--forceis given - Opens them in your default editor
Remove Worktrees
branchyard remove agent-factory upgrades-marketplace
# Prompts: "Also delete the git branches? (y/N):"By default, clean worktrees are removed in parallel and branch deletion is optional. A failed target is reported without hiding successful removals.
Safely delete merged branches with git branch -d:
branchyard remove agent-factory --delete-branchForce-delete an unmerged branch with a dedicated confirmation:
branchyard remove agent-factory --force-delete-branchUse --force to remove a dirty worktree after two confirmations. Preview any
removal without prompting or changing worktrees or branches:
branchyard remove agent-factory --dry-run --force --force-delete-branchList Worktrees
branchyard listShows all active worktrees with branch, commit, and age.
Prune Stale Metadata
branchyard prune --auto
branchyard prune --auto --dry-runprune --auto removes only stale Git worktree metadata. It does not remove
physical worktree directories. Manual prune mode is not implemented.
Save a Session
branchyard save-session sprint-42This records active branchyard-managed worktrees under .worktrees/, the
current branch as their base, and the configured default editor.
Restore a Session
branchyard restore sprint-42If no name is given:
branchyard restoreRestores the last saved session.
Restore recreates missing worktrees sequentially, reuses worktrees already in their managed locations, uses the saved editor, and asks before replacing an existing workspace file.
List Sessions
branchyard sessionsDelete a Session
branchyard delete-session sprint-42🏷 Flags Reference
| Flag | Applies to | Description |
|------|------------|-------------|
| --base <branch> | create | Base revision for new branches (default: main) |
| --no-create | create | Skip Git creation and regenerate the workspace from the supplied names |
| --open | create | Open the workspace in the selected editor |
| --cwd <path> | create | Use this repository path instead of the current directory |
| --dry-run | create, remove, prune | Preview the command without changing state |
| --force | create, remove | Replace the workspace file, or allow dirty worktree removal after confirmation |
| --delete-branch | remove | Delete each branch with safe git branch -d after removing its worktree |
| --force-delete-branch | remove | Delete with git branch -D after a dedicated confirmation |
| --allow-subdir | create, remove | Suppress create's below-root warning; accepted by remove for command symmetry |
| --sequential | create, remove | Remove targets one at a time; create accepts it but is already sequential |
| --auto | prune | Run Git's automatic stale-metadata pruning |
| --fun | global | Show the Easter egg |
| --help, -h | global | Show CLI help |
🔍 Comparison: Raw git worktree vs branchyard
| Task | Raw git worktree | branchyard |
|------|--------------------|------------|
| Create 2 worktrees | git worktree add ../foo foo && git worktree add ../bar bar | branchyard foo bar |
| Remove worktree | git worktree remove ../foo | branchyard remove foo |
| List worktrees | git worktree list | branchyard list (with branch, commit, age) |
| Restore session | (manual) | branchyard restore my-session |
🎉 Fun Features
We take productivity seriously… but we also believe your tools should make you smile.
- Easter Eggs: Create more than one worktree at a time and… well, you’ll see. 😉
- On-Demand Fun: Run
branchyard --funto instantly trigger one of our Easter eggs. - CLI Personality: branchyard isn’t just functional — it’s got character.
- Shareable Moments: Some outputs are just begging to be screenshotted and shared.
💡 Tip: Keep an eye out for special surprises when you’re working in parallel.
🛠 Troubleshooting
Error: Git not found
- Install Git: https://git-scm.com/
Error: Editor CLI not found
- Enable your editor's CLI in PATH (e.g., VS Code →
codecommand)
🧩 Workspace Template Example
You can customize the generated .code-workspace by adding a workspaceTemplate to your ~/.branchyardrc:
{
"workspaceTemplate": {
"settings": {
"editor.formatOnSave": true,
"typescript.tsdk": "node_modules/typescript/lib"
},
"extensions": {
"recommendations": ["dbaeumer.vscode-eslint"]
}
}
}This template will be merged with the generated folders array for your worktrees.
🤝 Contributing
- Fork the repo
- Create a feature branch
- Commit your changes
- Open a PR
📜 License
MIT License — feel free to use, modify, and share.
💡 Inspiration
A developer’s repo is their yard and their pride. branchyard helps you keep your digital yard manicured — clean branches, productive workflows, AI-era ready.
