unirepo-cli
v0.3.0
Published
CLI tool for creating and managing git-subtree monorepos — run your agents across repos
Maintainers
Readme
unirepo
One workspace to refactor your whole stack in one go
Work across multiple repos like they’re one. Unirepo turns multiple GitHub repositories into a single unified workspace. Edit backend, frontend, and shared code in one tree, commit from one place, and push changes back to each repo using the same branch.
Built for AI coding agents
AI agents need full context to make correct changes—not one repo at a time. Unirepo gives them a single workspace to refactor your entire stack, keep changes consistent, and push updates back to each repo.
Example task
You need to update:
api/for a new endpointweb/for the UIshared/for shared types
Without unirepo
# clone and branch in each repo
git clone [email protected]:org/api.git
git clone [email protected]:org/web.git
git clone [email protected]:org/shared.git
cd api
git checkout -b feature-auth
cd ../web
git checkout -b feature-auth
cd ../shared
git checkout -b feature-auth
# edit in 3 separate checkouts
# commit in each repo
cd ../api
git add .
git commit -m "feat: add auth"
cd ../web
git add .
git commit -m "feat: add auth UI"
cd ../shared
git add .
git commit -m "feat: add auth types"
# push from each repo
cd ../api
git push -u origin feature-auth
cd ../web
git push -u origin feature-auth
cd ../shared
git push -u origin feature-authWith unirepo
# create one workspace and one branch
unirepo init my-workspace <repo...>
cd my-workspace
unirepo branch feature-auth
# edit api/, web/, and shared/ together
# commit once from the workspace
git add .
git commit -m "feat: add auth flow"
# push changed subtrees
unirepo pushSame workflow, fewer commands
unirepo keeps your upstream repos separate while removing:
- Repo and branch juggling
- Repeated setup and commands
- Context switching
- Inconsistent cross-repo changes
It enables:
- One place to see the full change
- Safe cross-repo refactors
- A single workspace for humans and AI
Install
npm install -g unirepo-cliOnce installed, the command is just unirepo:
unirepo --versionOr use without installing:
npx unirepo-cli <command>Why it works well for agents
AI coding agents work best when they can see the full change at once.
- Update backend, frontend, and shared contracts in one pass
- Commit coordinated changes from one repo
- Check affected subtrees with
unirepo status - Push only changed subtrees with
unirepo push - Reuse the generated
AGENTS.mdworkflow guide
Commands
| Command | Description |
| --- | --- |
| init <dir> <repo...> | Create a new workspace from one or more repos |
| add <repo> | Add another repo to the workspace |
| pull [subtree...] | Pull upstream changes into tracked subtrees |
| status | Show subtrees, branches, and what changed |
| branch [name] | Create or show the current push branch |
| push [subtree...] | Push changed subtrees upstream |
init
unirepo init <dir> <repo-url> [repo-url...]Creates a new git repo at <dir>, imports each URL as a subtree, and generates an AGENTS.md workflow guide.
| Flag | Effect |
| --- | --- |
| --full-history | Import full git history (default: squash) |
add
unirepo add <repo-url> [--prefix <name>] [--branch <name>]Adds a repo to an existing workspace. The directory name defaults to the repo name.
| Flag | Effect |
| --- | --- |
| --prefix <name> | Override the subtree directory name |
| --branch <name> | Import from a specific upstream branch |
| --full-history | Import full git history |
pull
unirepo pull [subtree...] [--prefix <name>]Pulls upstream changes. Without arguments, pulls all tracked subtrees. When you use --branch without naming a subtree, unirepo skips tracked subtrees that do not have that upstream branch.
| Flag | Effect |
| --- | --- |
| --prefix <name> | Pull only one tracked subtree |
| --branch <name> | Pull a specific upstream branch |
| --full-history | Pull full history instead of squash |
status
unirepo status [--json]Shows tracked subtrees, their upstream branches, the current push branch, and which subtrees have changes.
branch
unirepo branch [name]With a name: creates and switches to a new branch. Without: shows the current branch and push targets.
push
unirepo push [subtree...] [--dry-run]Pushes changed subtrees upstream. Without arguments, auto-detects which subtrees have changes.
| Flag | Effect |
| --- | --- |
| --branch <name> | Override the upstream branch name |
| --dry-run | Show what would run without executing |
How It Works
unirepo is a thin wrapper around git subtree. Each repo you add becomes a directory in your workspace with a matching git remote. When you push, unirepo splits your commits per subtree and pushes each to its upstream.
There's no lock-in — the workspace is a standard git repo. You can always fall back to raw git subtree commands.
Development
npm test # run tests
npm run build # syntax checkLicense
MIT — see LICENSE.
