Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Reporter recursively reports and resolves drifts across multiple git repositories.

License

Notifications You must be signed in to change notification settings

devpies/reporter

Repository files navigation

reporter

Reporter recursively reports and resolves drifts across multiple git repositories.

Overview

Reporter recursively detects and resolves drift across multiple Git repositories. It ensures that local repositories remain synchronized with their remote counterparts, making it easier to manage large or multi-repo projects.

When run inside a Git repository, Reporter inspects only that repository. When run in a non-repository directory, it recursively scans all subdirectories, identifies Git repositories, and reports their synchronization status relative to the desired remote branch.

Reporter categorizes repositories as up-to-date or outdated depending on whether the local branch is behind the remote. If a repository is behind and the -u or --update flag is provided, Reporter automatically pulls the latest changes.

If local modifications are present, Reporter safely stashes them before updating, pulls the remote changes, and then reapplies the stashed work to preserve developer progress.

Help

Display help text (--help, -h):

$ rp -h

Usage: rp (reporter) [OPTIONS]

Reporter recursively reports and resolves drifts across multiple git repositories.

Options:
  --explain, -e     Show examples
  --help, -h        Show this help message
  --update, -u      Automatically update repositories that are behind
  --branch, -b      Specify the branch to check (default: main)
  --log, -l         Show the complete list of changes using git log
  --force, -f       Forcefully abort rebase and merge conflicts to update
  --remote, -r      Remote name (default: origin)

Installation

Prerequisites

Ensure you have Git and Go 1.18 >= installed on your machine.

Installing from Source

You can also install reporter by cloning the repository and building it from source. Follow these steps:

git clone https://github.com/devpies/reporter
cd reporter
go build -o rp .
sudo mv rp /usr/local/bin/rp

Installing with go install

You can install the binary directly using go install. Follow these steps:

  1. Set the environment variable for the Go path:

    export GOPATH=$(go env GOPATH)
  2. Install the binary:

    go install github.com/devpies/reporter@latest

    This command will download the package, compile it, and place the binary in your $GOPATH/bin.

  3. Ensure $GOPATH/bin is in your $PATH:

    export PATH=$PATH:$GOPATH/bin

    You can add this line to your shell configuration file (e.g., ~/.bashrc, ~/.zshrc) to make it persistent:

    echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
    echo 'alias rp=reporter' >> ~/.bashrc
    source ~/.bashrc

Configuration File (.rprc)

The .rprc file is an optional YAML configuration file that allows you to customize the behavior of the reporter tool. It can configure the remote and branch to check for updates, whether to automatically update repositories that are behind, and define which repositories to include or exclude from the check.

Place the .rprc file wherever you'd like to run reporter.

NOTE: When run in a git repository, rp will check both the current directory and its parent for configuration.

Include/Exclude Repositories

You can specify which repositories to include or exclude in the .rprc file.

  • Include List: If you specify an include list, only the repositories listed will be checked.
  • Exclude List: If you specify an exclude list, the repositories listed will be ignored.
  • Combination: If both lists are specified, the tool will check only the repositories listed in include and will exclude any repositories that are also listed in exclude. The exclude list refines the include list by removing repositories that should not be checked.

Example .rprc File

branch: main
update: true
include:
   - repo1
   - repo2
   - repo3
exclude:
   - repo3
remote_name: origin

Contributing

To contribute, please create an issue or pull request. For common development tasks, utilize the project's Makefile.

make install
make test
make build

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Reporter recursively reports and resolves drifts across multiple git repositories.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published