Skip to content

natikgadzhi/gitbatch

Repository files navigation

gitbatch

A simple CLI tool that batch-updates multiple git repositories in parallel.

Install

Homebrew

brew install natikgadzhi/taps/gitbatch

From source

go install github.com/natikgadzhi/gitbatch/cmd/gitbatch@latest

From releases

Download a binary from the releases page.

Usage

gitbatch <command> [flags]

gitbatch sync

Discovers git repositories under a directory, fetches and fast-forward merges them all in parallel. For dirty worktrees, stashes changes, pulls, and reapplies.

gitbatch sync [flags] [directory]
  -j, --jobs <n>       Max parallel operations (default: 6)
      --depth <n>      Max directory depth for discovery (default: 3)
      --no-stash       Skip repos with dirty worktrees instead of stashing

Global flags

  -o, --output         Output format: table, json (default: auto via TTY)
      --version        Print version
  -h, --help           Show help

gitbatch schedule

Set up a macOS LaunchAgent to run sync automatically.

gitbatch schedule set [flags] [directory]
gitbatch schedule show
gitbatch schedule remove
gitbatch schedule run
gitbatch schedule logs
      --time <time>    Run daily at a specific time (e.g. 8am, 2:30pm, 14:30)
      --every <dur>    Run on an interval (e.g. 4h, 30m, 1h30m)
  -j, --jobs <n>       Max parallel operations (default: 6)
      --depth <n>      Max directory depth for discovery (default: 3)
      --no-stash       Skip repos with dirty worktrees instead of stashing

--time and --every are mutually exclusive. If neither is specified, defaults to --time 8am.

Sleep/wake behavior: The schedule uses macOS launchd, which catches up on missed runs. If your laptop is asleep at the scheduled time, the sync runs automatically when you open the lid.

Examples

# Sync all repos under ~/src
gitbatch sync ~/src

# Use 12 parallel workers, search 5 levels deep
gitbatch sync -j 12 --depth 5 ~/projects

# Output JSON (useful for cron / piping)
gitbatch sync -o json ~/src

# Sync ~/src every morning at 8am
gitbatch schedule set --time 8am ~/src

# Sync every 4 hours
gitbatch schedule set --every 4h ~/src

# Check schedule status
gitbatch schedule show

# View recent logs
gitbatch schedule logs

License

MIT

About

Batch-update git repositories in parallel

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors