Skip to content

Repository files navigation

gitb — Blazing-fast multi-repo git batch tool

CIcrates.iolicense: MITrust: 1.74+

Run git across 100+ repos in parallel. Rust-powered, 3-4× faster than gita / mr. 用 Rust 写的多仓库 Git 批量工具,比 gita / mr 快 3-4 倍。

demo

Why gitb?

  • Fast — parallel execution via rayon. 100 repos status in ~2s. See benchmark →
  • Zero-config — works out of the box. cd into a folder of repos, run gitb status.
  • Cross-platform — macOS, Linux, Windows. Shell completion for bash / zsh / fish / powershell.

Install

macOS Homebrew:

brew install luolin1024/git-batch/gitb

Linux / macOS Cargo:

cargo install gitb

Windows PowerShell:

irm https://github.com/luolin1024/git-batch/raw/main/install.ps1 | iex

Windows Scoop:

scoop bucket add gitb https://github.com/luolin1024/git-batch
scoop install gitb

Verify:

gitb --version
Build from source
git clone https://github.com/luolin1024/git-batch.git
cd git-batch
cargo build --release
# Binary at ./target/release/gitb
Manual download

Download the right file from GitHub Releases:

PlatformFile
Windows x86_64gitb.exe

Windows: place gitb.exe anywhere in your PATH.

Quick start (30 seconds)

cd~/Work # a folder containing many git repos
gitb status # see all repos at a glance
gitb pull -j 8 # pull all in parallel
gitb doctor # health check: who's behind / dirty / unpushed

Features

CommandDescription (EN)中文描述
checkoutSwitch to a branch across all repos (fuzzy)在所有仓库中切换分支(支持模糊匹配)
createCreate and switch to a new branch创建并切换到新分支
statusShow colored multi-repo status overview显示多仓库状态概览(彩色)
pullPull from remote across all repos拉取远程更新
fetchFetch from remote across all repos获取远程引用
pushPush to remote across all repos推送至远程
execExecute arbitrary git commands执行任意 git 命令
branchList, delete branches across repos列出/删除分支
commitCommit changes across all repos提交更改
stashStash/pop/list/clear operations暂存/弹出/列出/清除
rebaseSmart rebase (stash -> rebase -> unstash)智能变基
diffShow diff across all repos显示差异
logShow commit log across all repos显示提交日志
doctorHealth check (ahead/behind/dirty/unpushed)健康检查
groupManage repo groups管理仓库分组
initInitialize workspace config interactively交互式初始化工作区配置
completionGenerate shell completion scripts生成 Shell 补全脚本

Usage

Basic Commands

gitb status # show status of all repos
gitb pull -j 8 # pull all in parallel (8 jobs)
gitb checkout main # switch to branch (fuzzy match)
gitb create feature/new # create and switch to new branch
gitb fetch # fetch from remote
gitb push # push to remote
gitb exec log --oneline -5 # run any git command
gitb commit -m "fix: update"# commit changes
gitb stash push # stash changes
gitb stash pop # pop stash
gitb rebase # smart rebase (auto-stash)
gitb rebase -b main # rebase onto specific branch
gitb diff # show diff
gitb log -n 10 # show last 10 commits per repo
gitb branch list # list branches
gitb branch delete old-feature # delete branch (-f force, --remote also remote)
gitb doctor # health check

Group Management

gitb group add frontend repo-a,repo-b,repo-c
gitb group list
gitb group show frontend
gitb group remove frontend
gitb status -g frontend # filter by group
gitb pull -g frontend

Workspace Initialization

gitb init # interactive setup, generates gitb.toml

Shell Completion

gitb completion bash >~/.bash_completion.d/gitb
gitb completion zsh > /usr/local/share/zsh/site-functions/_gitb
gitb completion fish >~/.config/fish/completions/gitb.fish
gitb completion powershell >>$PROFILE

Global Options

FlagDescription (EN)中文描述
-j NNumber of parallel jobs (0 = auto-detect)并行任务数(0 为自动检测)
--dry-runShow what would happen without executing模拟运行,不实际执行
-s <dirs>Skip directories (comma-separated)跳过指定目录(逗号分隔)
-d <depth>Max recursion depth for repo discovery仓库发现最大递归深度
-o <format>Output format: table, json, quiet输出格式
-fForce operation (discard uncommitted)强制操作(丢弃未提交更改)
-vVerbose output详细输出
-qQuiet mode (only show errors)静默模式(仅显示错误)
-g <group>Filter repos by group name按分组过滤仓库

Configuration (gitb.toml)

Optional — gitb works with zero config. Place gitb.toml in your workspace root:

[workspace]
default_branch = "main"default_skip = ["node_modules", "target"]
default_depth = 2
[groups.frontend]
repos = ["web-app", "mobile-app", "ui-kit"]
[groups.backend]
repos = ["api-gateway", "user-service", "payment-service"]

Performance

ToolLanguage50 repos (pull)100 repos (status)
gitbRust~1.2s~2.1s
gitaPython~4.5s~8.9s
myrepos (mr)Perl~3.8s~7.2s

Benchmarks measured on an 8-core machine with SSD. Your results may vary.

Comparison with alternatives

ToolLanguageParallelZero-configCross-platformShell completionSmart rebase
gitbRust✅ rayon✅ macOS/Linux/Windows✅ bash/zsh/fish/pwsh✅ stash→rebase→unstash
gitaPythonpartial
myrepos (mr)Perl❌ config file
mu-repoPython

FAQ

Q: gitb not found after install? A: Restart your terminal so PATH changes take effect.

Q: Can't find my repos? A: Default scan depth is 1. Use -d 2 or -d 3 for nested directories.

Q: Not sure what a command will do? A: Add --dry-run to preview without executing.

Q: Skip certain directories? A: -s node_modules,target,.vscode (comma-separated).

Contributing

See CONTRIBUTING.md. PRs welcome — cargo fmt and cargo clippy must pass.

License

MIT

About

Blazing-fast multi-repo git batch tool. Rust-powered, 3-4x faster than gita. 跨平台多仓库 Git 批量工具。

Topics

Resources

Code of conduct

Contributing

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages