Skip to main content

A CLI tool for managing GitHub repos

Project description

ghops - GitHub Operations

A Python CLI tool for cloning, updating, and managing multiple GitHub repositories at once.

License: MIT

Overview

ghops is a command-line utility that wraps Git and GitHub CLI (gh) commands to automate common repo-management tasks. It can:

  • Clone repositories from one or more GitHub users or organizations.
  • Update local repositories (commit changes, pull, handle merge conflicts, and optionally push).
  • Display status for a batch of repos, with optional JSON output.

It's designed to help you automate your daily Git operations in bulk, especially if you juggle many repositories at once.

Features

  • Bulk repository cloning from multiple users or organizations.
  • Selective ignoring of repositories you don't want to touch.
  • Dry-run mode to preview actions before actually running them.
  • Auto-commit local changes with a custom commit message.
  • Auto-resolve merge conflicts with simple strategies (ours, theirs, or abort).
  • Optional interactive prompts before pushing.
  • Rich command-line output with optional JSON for machine parsing.

Installation

Prerequisite: You must have the gh CLI and Git installed.
Python: Version 3.7 or later is recommended.

Once published to PyPI, you can install with:

pip install ghops

(If you’re not planning to publish on PyPI yet, you can still install locally:)

git clone https://github.com/<username>/ghops.git
cd ghops
pip install .

Usage

ghops has three main subcommands: get, update, and status.

ghops [GLOBAL_OPTIONS] <subcommand> [SUBCOMMAND_OPTIONS]

1. get

Clone repositories from GitHub users or organizations:

ghops get [user1 user2 ...] [--ignore repo1 repo2 ...] [--limit N] [--dry-run] [--dir /path/to/clone]
  • users: GitHub usernames or orgs to clone from. If none is provided, it defaults to the authenticated user.
  • --ignore: Space-separated list of repo names to skip.
  • --limit: Maximum number of repos to fetch per user/org (default 1000).
  • --dry-run: Print out what would happen but do not perform any actions.
  • --dir: Directory to clone into (default is the current directory).

2. update

Update all Git repositories within a directory:

ghops update [--auto-commit] [--commit-message "Your message"] [--auto-resolve-conflicts abort|ours|theirs]
             [--prompt] [--ignore repo1 repo2 ...] [--dry-run] [--dir /path/to/repos] [--recursive]
  • --auto-commit: Automatically commit local changes before pulling.
  • --commit-message: Set a custom commit message for auto-commits.
  • --auto-resolve-conflicts: Merge-conflict strategy: abort, ours, or theirs.
  • --prompt: Prompt interactively before pushing changes.
  • --ignore: Space-separated list of repo names to skip.
  • --dry-run: Show what would happen without changing anything.
  • --dir: Directory to look for Git repositories (default .).
  • --recursive: Recursively search for repositories in all subdirectories.

3. status

Display the Git status of each repository within a directory:

ghops status [--json] [--recursive] [--dir /path/to/repos]
  • --json: Output the repo statuses in JSON instead of a table.
  • --recursive: Recursively find repos within subdirectories.
  • --dir: Base directory to search (default .).

Examples

  1. Clone repos from user octocat, ignoring two specific repos, into a new folder:
    ghops get octocat --ignore some-repo another-repo --dir my-github-repos
    
  2. Recursively update all repos in my-github-repos, auto-committing any local changes:
    ghops update --auto-commit --commit-message "update from ghops" --dir my-github-repos --recursive
    
  3. Check status of all repos (top-level only) in a directory:
    ghops status --dir my-github-repos
    

Contributing

  1. Fork this repository and clone your fork.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes and test thoroughly.
  4. Submit a pull request!

License

This project is MIT Licensed. Feel free to fork, modify, and use it in your own projects.

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

ghops-0.3.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

ghops-0.3.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file ghops-0.3.0.tar.gz.

File metadata

  • Download URL: ghops-0.3.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for ghops-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9472f44d71341e3570a533706af3a233984d5ce813d8af79c87db06595510b1f
MD5 6ff20915619343215437c0532560bebd
BLAKE2b-256 9c39a1a47d350e9526555807cf78565f4d9e4da0179886f8a696e94ae9e8adf0

See more details on using hashes here.

File details

Details for the file ghops-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ghops-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for ghops-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93293d190524436fe7aefbc30ab25eab3db12a69f5347a6dc516d8bb7b65428b
MD5 77b6aeac1bab0f43bb75525f23e82c4a
BLAKE2b-256 3723b4335f7cdc21489e3073e7701345d8ca0ab492ed20c21d8628c2c9cad1b1

See more details on using hashes here.

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