Skip to main content

Manage multiple git repositories with ease

Project description

gitmux

Manage multiple git repositories with ease. Clone, pull, push, and run commands across repos with a single command.

Features

  • YAML configuration — declarative repo management
  • Group management — organize repos into groups
  • Batch git operations — clone/pull/push across repos
  • Pre/post hooks — run commands before/after git operations (e.g., npm install after pull)
  • Template system — share hook configs across similar repos
  • Parallel execution — speed up operations with --parallel flag
  • Status overview — see all repos' git status at a glance
  • Arbitrary command execution — run any shell command across repos

Install

pip install gitmux

Quick Start

# Initialize config in current directory
gitmux init

# Add repos (default group if --group omitted)
gitmux add git@github.com:user/api-server.git --group backend
gitmux add git@github.com:user/auth-service.git --group backend

# Clone all repos
gitmux clone --all

# Pull a single repo
gitmux pull backend/api-server

# Pull entire group (parallel)
gitmux pull --group backend --parallel

# Check status of all repos
gitmux status

# Run command on a specific repo
gitmux exec "git checkout main" --target backend/api-server

Configuration

Config file lookup order (used for both reading and writing):

  1. --config / -c flag (explicit path)
  2. .gitmux.yaml in current directory
  3. ~/.gitmux.yaml (global fallback)
workspace: ~/projects

templates:
  node-app:
    post_pull:
      - npm install
    pre_push:
      - npm test

groups:
  backend:
    repos:
      - name: api-server
        url: git@github.com:user/api-server.git
        template: node-app
      - name: auth-service
        url: git@github.com:user/auth-service.git
        path: ~/custom/path/auth  # override default path
        hooks:
          post_pull:
            - pip install -r requirements.txt
  frontend:
    repos:
      - name: web-app
        url: git@github.com:user/web-app.git
        template: node-app

Path Resolution

  • Default: {workspace}/{group}/{repo_name}
  • Override per-repo with the path field

Branch Management

Configure named branch aliases per repo:

repos:
  - name: map
    url: https://code.example.com/base/map.git
    branches:
      prod: "bInfinite-plan-*"    # pattern (contains *)
      dev: "bInfinite-dev-main"   # fixed branch name

Usage:

gitmux pull map --branch dev           # checkout fixed branch → pull
gitmux pull map --branch prod:latest   # fetch → find newest matching branch → checkout → pull
gitmux pull map --branch prod:260515   # replace * → checkout bInfinite-plan-260515 → pull
gitmux pull map --branch prod:~260520  # fetch → find latest branch with date <= 260520 → checkout → pull
gitmux pull --group base --branch dev  # checkout fixed branch for all repos in group

Rules:

  • --branch <alias> — alias must be a fixed branch (no *), otherwise error
  • --branch <alias>:latest — alias must be a pattern (has *), picks newest by commit date
  • --branch <alias>:~<date> — alias must be a pattern, picks newest matching branch with date ≤ <date>
  • --branch <alias>:<value> — alias must be a pattern, replaces * with <value>

Hook System

Hooks run shell commands before/after git operations:

  • pre_clone, post_clone
  • pre_pull, post_pull
  • pre_push, post_push

Error handling:

  • Pre-hook failure → git operation is skipped
  • Post-hook failure → repo marked as failed

Template merging: Repo-level hooks override template hooks per hook type.

Commands

Command Description
gitmux init Create .gitmux.yaml in current dir (--global for ~/.gitmux.yaml)
gitmux add <url> --group <g> Add a repository (group auto-created)
gitmux remove <name> Remove a repository
gitmux list List all repositories
gitmux status [target] Show git status overview (defaults to all)
gitmux clone <target> Clone unclosed repositories
gitmux fetch <target> Fetch remote data (--branches to list branches)
gitmux pull <target> Pull latest changes
gitmux push <target> Push local commits
gitmux exec <cmd> Run command in repos (--target to specify)
gitmux group list List groups
gitmux group create <name> Create a group
gitmux group remove <name> Remove a group

Target Syntax

gitmux pull map           # repo 'map' in default group
gitmux pull base/map      # repo 'map' in group 'base'
gitmux pull --group base  # all repos in group 'base'
gitmux pull --all         # all repos (explicit)
gitmux pull               # error: specify target, --group, or --all

Note: gitmux add <url> without --group places the repo in the default group.

Common Options

  • --group, -g — operate on entire group
  • --all, -a — operate on all repositories (required for write operations without target)
  • --parallel, -p — run in parallel (clone/fetch/pull/push/exec)
  • --config, -c — custom config file path

Development

git clone https://github.com/ryan/gitmux.git
cd gitmux
pip install -e ".[dev]"
pytest

Code Quality

Uses Ruff for linting and formatting:

ruff check .          # lint
ruff check --fix .    # auto-fix
ruff format .         # format

Rules: E, F, W, I (isort), N, UP (modern Python), B (bugbear), SIM.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitmux-0.1.1.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitmux-0.1.1-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file gitmux-0.1.1.tar.gz.

File metadata

  • Download URL: gitmux-0.1.1.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gitmux-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9bf5be632a86f983b2eb377cb62a06541fe706e367b5530c9915ab4ee4929fa4
MD5 0e8e820b10606e7a200b7c6f45b3146a
BLAKE2b-256 309b77159bb86d0e65382cbf76eac86f833baa74d35f5f815f1ee7f7c1ae44a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitmux-0.1.1.tar.gz:

Publisher: publish.yml on ryanwx/gitmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gitmux-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gitmux-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gitmux-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 480b2a55d9d0ec4a590c55a3bbe30d9b45041578561a4aa0c7acc9c16adb7d28
MD5 7ce5ccafe606799e0947610f933a65d3
BLAKE2b-256 9bdd473f2edc1c4050e718adfe4e544e7e694bfab8d514dff7f228123ab1ca2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitmux-0.1.1-py3-none-any.whl:

Publisher: publish.yml on ryanwx/gitmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page