@frozencrow/monogit
v1.2.1
Published
A CLI tool to manage multiple git repositories in a parent directory.
Readme
🚀 monogit
Manage multiple git repositories under a single parent folder with one command.
monogit gives you a monorepo workflow without a monorepo. Run git operations across all your linked repositories simultaneously — branching, committing, pushing, and more — with a single command.
✨ Features
- Interactive Setup — Scan a directory, detect existing repos, and optionally initialize new ones
- Unified Git Commands — Run
checkout,add,commit,push,pullacross all repos at once - Visual Split-Screen — View
status,log, anddifffor every repo in partitioned terminal boxes - Parallel Execution — All commands run concurrently across repos for maximum speed
- Error Resilience — One repo failing won't block the others
- Shell Autocompletion — Support for Bash and Zsh tab completion
📦 Installation
npm i -g @frozencrow/monogitOnce installed, monogit is available as a global command.
Enable Tab Completion
Tab completion is automatically set up during installation for Zsh and Bash.
If it's not working, or if you need to set it up manually, you can run:
For Zsh:
echo 'source <(monogit completion zsh)' >> ~/.zshrc
source ~/.zshrcFor Bash:
echo 'source <(monogit completion bash)' >> ~/.bashrc
source ~/.bashrc🛠 Getting Started
1. Initialize your workspace
Navigate to a parent directory that contains (or will contain) your git repositories, then run:
monogit initThis will:
- Scan all subdirectories
- Detect which ones are already git repositories
- Let you select which repos to link
- Offer to
git initany non-git directories you want to include - Save the configuration to
.monogit.json
2. Start working across repos
# Create a new branch in all repos
monogit checkout -b feature/my-feature
# Check status across all repos
monogit status
# Stage all changes
monogit add .
# Commit everywhere
monogit commit -m "implement shared feature"
# Push to all remotes
monogit push origin feature/my-feature📖 Commands
monogit completion [shell]
Generate shell completion script for Bash or Zsh.
# Generate for Zsh (default)
monogit completion zsh
# Generate for Bash
monogit completion bashmonogit init
Interactively configure which repositories to manage.
monogit init- Scans the current directory for subdirectories
- Presents existing git repos for selection
- Offers to initialize git in non-repo directories
- Saves configuration to
.monogit.json
monogit checkout <branch>
Switch branches across all linked repositories.
# Switch to an existing branch
monogit checkout main
# Create and switch to a new branch
monogit checkout -b feature/new-work| Option | Description |
|--------|-------------|
| -b | Create a new branch |
monogit add <paths...>
Stage files across all linked repositories.
# Stage everything
monogit add .
# Stage specific files
monogit add src/ README.mdmonogit commit
Commit staged changes across all linked repositories.
# Commit staged changes
monogit commit -m "your commit message"
# Stage and commit all tracked changes
monogit commit -am "your commit message"
# Commit specific paths
monogit commit -m "update docs" docs/| Option | Description |
|--------|-------------|
| -m <message> | Required. Commit message |
| -a | Automatically stage modified/deleted files |
monogit push [remote] [branch]
Push commits to remote repositories.
# Push (default remote/branch)
monogit push
# Push to a specific remote and branch
monogit push origin mainmonogit pull [remote] [branch]
Pull updates from remote repositories.
# Pull (default remote/branch)
monogit pull
# Pull from a specific remote and branch
monogit pull origin mainmonogit fetch [remote] [branch]
Fetch updates from remote repositories.
# Fetch (default remote/branch)
monogit fetch
# Fetch from a specific remote and branch
monogit fetch origin mainmonogit merge <branch>
Merge a branch into the current branch across all linked repositories.
# Merge a specific branch
monogit merge feature/my-featuremonogit branch [branch]
List, create, or delete branches across all linked repositories.
# List branches (relative to the first repo)
monogit branch
# Create a new branch
monogit branch feature/new-idea
# Delete a branch
monogit branch -d stale-feature| Option | Description |
|--------|-------------|
| -d, --delete | Delete a branch |
| -D | Force delete a branch |
monogit status
View the git status of all linked repositories in a split-screen layout.
monogit statusEach repository's status is displayed in its own bordered box for easy scanning.
monogit log
View recent commit history across all repositories.
monogit logShows the last 5 commits per repo in a compact graph format, each in a separate box.
monogit diff
View unstaged changes across all repositories.
monogit diffDisplays diffs for each repository in separate bordered boxes with color-coded output.
⚙️ Configuration
monogit stores its configuration in a .monogit.json file in the working directory:
{
"repos": [
"api",
"client",
"shared-lib"
]
}Each entry is a relative path to a subdirectory containing a git repository.
Tip: You can commit
.monogit.jsonto share configuration with your team, or add it to.gitignoreif it's personal.
🏗 Project Structure
monogit/
├── index.js # CLI entry point
├── package.json
├── .monogit.json # Generated config (per workspace)
└── src/
├── commands/
│ ├── init.js # Interactive repo linking
│ ├── git-proxy.js # Parallel proxy for standard git commands
│ ├── visual.js # Split-screen output for log/diff/status
│ ├── completion.js # Shell completion script generation
│ └── complete.js # Dynamic branch completion logic
└── utils/
├── config.js # Read/write .monogit.json
└── git.js # Git command execution via execa
├── scripts/
│ └── postinstall.js # Automatic completion setup during npm install🧰 Built With
- Commander.js — CLI framework
- Inquirer.js — Interactive prompts
- execa — Process execution
- chalk — Terminal styling
- ora — Spinners
- boxen — Boxed terminal output
📄 License
ISC
