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.1.tar.gz (10.7 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.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ghops-0.3.1.tar.gz
  • Upload date:
  • Size: 10.7 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.1.tar.gz
Algorithm Hash digest
SHA256 6fde2ef3d3b847279e820eb55b28a09104aac3dda5463f9147ef4a377f8d486f
MD5 a62cb0eed45a4a89165ad93498efb954
BLAKE2b-256 5b12ae13814439815d917c34a2eaf11d68f7a1f737fd9efe9a9c0936c6e192e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ghops-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b140d61e2b3c53a744fb1340241523d1dcb884a6104e30077676a8941a1e662c
MD5 f3c1d6a4241ee51b0ae6286c6b41efa7
BLAKE2b-256 c5ad3b35c158bced102c722d0aab1a7a02ccb1199067a0beab820d36a12480a8

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