Skip to main content

A CLI tool for managing GitHub repos

Project description

ghops

PyPI License Python Version

ghops is a powerful command-line tool to streamline the management of your GitHub repositories. Whether you need to clone multiple repositories, keep them updated, or check their statuses, ghops provides an intuitive interface with rich, informative outputs.

Table of Contents

Features

  • Clone Multiple Repositories: Easily clone repositories from multiple GitHub users or organizations.
  • Update Repositories: Automatically commit, pull, handle merge conflicts, and push changes across all your repositories.
  • Check Status: Get a comprehensive overview of the status of all your repositories in either table or JSON format.
  • Rich Console Output: Utilizes the rich library for enhanced, readable console outputs.
  • Dry Run Mode: Simulate actions without making any changes, perfect for testing.
  • Conflict Resolution: Automatically resolve merge conflicts using predefined strategies.
  • Progress Indicators: Visual progress bars to track operations in real-time.

Prerequisites

Before installing ghops, ensure you have the following installed:

Note: ghops relies on the GitHub CLI (gh) for interacting with GitHub APIs. Make sure you are authenticated using gh auth login before using the tool.

Installation

You can install ghops via pip:

pip install ghops

Alternatively, you can install it from the source:

git clone https://github.com/queelius/ghops.git
cd ghops
pip install .

Usage

ghops provides three main subcommands:

  1. get: Clone repositories from specified GitHub users or organizations.
  2. update: Update all cloned repositories by committing, pulling, and pushing changes.
  3. status: Display the current status of all repositories.

Clone Repositories (get)

Clone repositories from GitHub users or organizations.

Syntax

ghops get [users ...] [options]

Options

  • users: List of GitHub usernames or organization names to clone repositories from. If omitted, defaults to the authenticated user.
  • --ignore: List of repository names to ignore.
  • --limit: Maximum number of repositories to fetch per user/org (default: 1000).
  • --dry-run: Simulate actions without making any changes.
  • --dir: Directory to clone repositories into (default: current directory).
  • --visibility: Repository visibility (all, public, private; default: all).

Update Repositories (update)

Update all cloned Git repositories by committing changes, pulling the latest updates, handling conflicts, and pushing changes.

Syntax

ghops update [options]

Options

  • --auto-commit: Automatically commit changes before pulling.
  • --commit-message: Custom commit message for auto-commits (default: "Auto-commit from update script").
  • --auto-resolve-conflicts: Automatically resolve merge conflicts (abort, ours, theirs).
  • --prompt: Prompt before pushing changes.
  • --ignore: List of repositories to ignore.
  • --dry-run: Simulate actions without making any changes.
  • --dir: Base directory to search for Git repositories (default: current directory).
  • --recursive: Recursively search for Git repositories.

Check Status (status)

Display the current status of all Git repositories in a specified directory.

Syntax

ghops status [options]

Options

  • --json: Output statistics in JSON format (default: table format).
  • --recursive: Recursively search for Git repositories.
  • --dir: Directory to search for Git repositories (default: current directory).

Examples

Clone Repositories from Multiple Users

ghops get user1 user2 org1 --dir ~/projects/github --ignore repo-to-ignore --limit 50

Update All Repositories with Automatic Commits and Conflict Resolution

ghops update --auto-commit --commit-message "Sync changes" --auto-resolve-conflicts theirs --dir ~/projects/github --recursive

Check the Status of All Repositories in JSON Format

ghops status --json --dir ~/projects/github --recursive

Perform a Dry Run of Cloning Repositories

ghops get user1 --dry-run --dir ~/projects/github

Configuration

Authentication

Ensure you are authenticated with GitHub CLI before using ghops:

gh auth login

Environment Variables

  • GITHUB_TOKEN: You can set a GitHub personal access token via the GITHUB_TOKEN environment variable for authentication if needed.

Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository: https://github.com/queelius/ghops/fork

  2. Create a feature branch:

    git checkout -b feature/YourFeature
    
  3. Commit your changes:

    git commit -m "Add your feature"
    
  4. Push to the branch:

    git push origin feature/YourFeature
    
  5. Open a Pull Request: Describe your changes and submit.

Reporting Issues

If you encounter any issues or have suggestions, please open an issue.

License

This project is licensed under the MIT License.


© 2025 Your Name

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.4.0.tar.gz (12.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.4.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ghops-0.4.0.tar.gz
  • Upload date:
  • Size: 12.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.4.0.tar.gz
Algorithm Hash digest
SHA256 d356c6fa693ea2c104c36929809dc84e9b329e24995addf03cc766f8889be74f
MD5 c8c51ded3d37798627fa047205f547af
BLAKE2b-256 bae38bb7485e54ff25153e030ecf0701bed4dbc081d50650f8835c41e055f86e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ghops-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4530de5874e40643096f42c26434f3365cc4f3b9f80965dd2d1d26e52443ebf
MD5 9f3129099f06d85e94cade50493bcaa6
BLAKE2b-256 c21b8eaf883f3145fb87562a68ec1b707ea77d6fd3c2b3a91fff0ae05c448462

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