Bulk-update, inspect, and reconcile git repositories at scale.
Fast parallel pulls, status checks, and safe git operations across directory trees.
GRR is a CLI tool that finds all git repositories under a directory and reconciles them — fetching, pulling, stashing, resetting, and cleaning — in a single command. Built for developers and platform engineers managing many repos locally.
Features:
- Discover and pull all git repos in a directory tree
- Parallel execution for speed (
-p N) - Safe pipeline: fetch → status-check → stash → checkout → reset → clean → pull
- Dry-run mode to preview changes
- Shallow clone handling, submodule updates, garbage collection
- Status overview across all repos (branch, dirty state, ahead/behind)
- Structured logging (colored, leveled, file output)
- Skip patterns to exclude repos
- Configurable branch priority and timeouts
- Strict mode (fail-fast) or continue-on-error (default)
# Clone
git clone https://github.com/PlatformStackPulse/git-repo-reconciler.git
cd git-repo-reconciler
# Setup dev tools
make dev-setup
# Build
make build
# Run
./bin/grr pull --fetch --check-status ~/projects
./bin/grr status ~/projectsBuild and install grr so it's available system-wide from any terminal:
# Build the binary
make build
# Copy to ~/.local/bin (create it if it doesn't exist)
mkdir -p ~/.local/bin
cp bin/grr ~/.local/bin/grr
chmod +x ~/.local/bin/grrIf ~/.local/bin is not already in your PATH, add it to your shell profile:
# For zsh (~/.zshrc)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
# For bash (~/.bashrc)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcVerify the installation:
grr --version# Recommended: safe pull with full features
grr pull --fetch --check-status --stash -V /repos
# Fast parallel pull with logging
grr pull --fetch -p 4 --log pull.log /repos
# Preview before running
grr pull -d --fetch /repos
# With custom branches and skip patterns
grr pull --fetch -b "main,develop" -s "*test*" /repos
# Full pipeline
grr pull --fetch --stash --submodules --verify --gc /reposPipeline steps (in order):
--fetch— Fetch all remotes with pruning and tags--check-status— Warn about uncommitted changes--handle-shallow— Convert shallow clones to full repos--stash— Stash uncommitted changes before pulling- Checkout branch (tries
master,main,developor custom-b) - Hard reset to
origin/<branch> - Clean untracked files
--submodules— Update submodules recursively- Pull with rebase
--verify— Show recent commits--gc— Run garbage collection
# Show status of all repos
grr status /repos
# Skip certain repos
grr status -s "*vendor*" /reposOutputs a table with repository name, branch, state (clean/dirty), and remote URL.
| Flag | Description |
|---|---|
-h, --help |
Show help |
-v, --version |
Show version |
-V, --verbose |
Enable debug output |
--log FILE |
Log to file |
| Flag | Description |
|---|---|
-d, --dry-run |
Preview without changes |
-p, --parallel N |
Run N parallel jobs (default: 1) |
-b, --branches B1,B2 |
Branches to try (default: master,main,develop) |
-s, --skip PATTERN |
Skip repos matching pattern (repeatable) |
-t, --timeout SECS |
Git operation timeout (default: 300) |
--fetch |
Fetch remotes first |
--stash |
Stash changes before pulling |
--check-status |
Warn about uncommitted changes |
--submodules |
Update submodules recursively |
--verify |
Show recent commits after pull |
--handle-shallow |
Convert shallow clones |
--gc |
Garbage collect after pull |
--strict |
Fail on first error |
--max-log N |
Commits to show with --verify (default: 3) |
git-repo-reconciler/
├── src/
│ ├── main.sh # Entry point & command dispatcher
│ └── commands/
│ ├── pull.sh # Bulk-pull reconciliation command
│ └── status.sh # Status overview command
├── lib/
│ ├── git.sh # Atomic git operations
│ ├── discovery.sh # Repo discovery & skip patterns
│ ├── logging.sh # Structured logging (colored, leveled)
│ ├── config.sh # Configuration (env vars + defaults)
│ ├── errors.sh # Error codes & handling
│ ├── utils.sh # Validation utilities
│ └── version.sh # Version info (injected at build)
├── test/
│ ├── unit/ # Unit tests (BATS)
│ └── integration/ # Integration tests
├── Makefile # Build targets
├── Dockerfile # Container build
└── .github/workflows/ # CI/CD
make help # Show all targets
make build # Build portable binary into bin/grr
make run # Build and show help
make test # Run all tests
make lint # Run ShellCheck
make fmt # Format with shfmt
make security # Security checks
make clean # Clean build artifacts
make dev-setup # Install dev tools + git hooksdocker build -t grr .
docker run --rm -v /your/repos:/repos grr pull --fetch /reposSee CONTRIBUTING.md for workflow, commit conventions, and testing guidelines.
See SECURITY.md for vulnerability reporting and security scanning.