multi worktree

One branch name. Many real Git repositories.

`mwt` gives independent repos a shared worktree workflow while keeping every repository, branch, merge, and failure mode visible.

feature-auth

$ mwt create feature-auth
created backend  -> worktrees/feature-auth/backend
created frontend -> worktrees/feature-auth/frontend
created infra    -> worktrees/feature-auth/infra

$ mwt status feature-auth
backend   feature-auth clean +2/-0
frontend  feature-auth dirty +1/-0
infra     feature-auth clean +0/-0

The model

Not a monorepo. Not a magic branch. Just coordinated Git.

Each source repository remains canonical. `mwt` records those repos in a local config file, creates real Git worktrees under a common directory, and runs standard Git commands inside each repo.

A multi-worktree name such as `feature-auth` becomes one branch per repository. The name is shared; the history is still independent.

workspace/
  mwt.yaml
  repos/
    backend/
    frontend/
    infra/
  worktrees/
    feature-auth/
      backend/
      frontend/
      infra/

Config

Let the tool keep the repo list current.

`mwt init` discovers non-nested Git repositories and writes their relative paths, current branches, and remotes. `mwt sync` repeats that scan, adding new repos and removing entries whose directories are gone.

worktree_root: ./worktrees
base_branch: main

repos:
  backend:
    path: ./repos/backend
    branch: main
    remotes:
      origin: git@github.com:org/backend.git

Commands

The daily loop is intentionally small.

01

Initialize

mwt init

Scan the workspace and create `mwt.yaml` from real Git repos.

02

Synchronize

mwt sync

Refresh paths, branches, and remotes after repos are added or removed.

03

Clone a project

mwt clone git@github.com:org/workspace.git

Clone a config repo, then initialize every repository it describes.

04

Fetch a base

mwt fetch main

Fetch every canonical repo and check each one out to a common branch.

05

Create worktrees

mwt create feature-x

Create one real Git worktree per configured repository.

06

Inspect work

mwt status feature-x

Show branch, clean state, ahead/behind counts, and short status.

07

Run commands

mwt foreach feature-x -- go test ./...

Execute the same command inside every named worktree.

08

Snapshot

mwt snapshot feature-x

Print the exact commit in each repo before a risky operation.

09

Merge carefully

mwt merge feature-x --dry-run

Validate all repos before merging. Cross-repo merges are not atomic.

One last thing

Put the workspace file in Git.

Create a repository for `mwt.yaml` and share it with the team. Use it to track all company repositories, the most important ones, or a single project that spans several repos.

After cloning the shared config, use `mwt clone URL [DIR]` to add repositories to the workspace. `mwt` syncs the config and checks out the base branch, so each person gets the same multi-repo map and can create parallel worktrees without losing the shared project shape.

$ git clone git@github.com:org/workspace-config.git
$ cd workspace-config
$ mwt clone git@github.com:org/backend.git repos/backend
$ mwt clone git@github.com:org/frontend.git repos/frontend

repos/
  backend/
  frontend/
  infra/

Install

One binary, released from tags.

Tagged releases publish archives, checksums, a changelog, and a Homebrew cask. The binary also includes a `version` command so you can check exactly what was installed.

install

$ brew tap towebuorg/tap
$ brew install --cask mwt
$ mwt version