Skip to content

George-Ogden/mirror-rorrim

Repository files navigation

Mirror|rorriM

Motivation

How many Git repos do you have? I have over 100 (but most of them are stale). Even in the last two weeks (when this was made), I'd edited over 10 different ones. They also rely on multiple configuration files that I frequently update (see all the ones in the root of this repo). How do I manage them all? I mirror them from a centralized config repo (https://github.com/George-Ogden/config).

Usage

You have the same problem? Just follow these three steps:

  1. Install from GitHub:
uv pip install git+https://github.com/George-Ogden/mirror-rorrim

(miss off the uv if you're still using pip).

  1. Make a configuration file called .mirror.yaml in the root of your repository (skip this step if you already have a config you want to use):
repos:
  - source: <location of config files> # anything you can git clone ...
    files:
      - mypy.ini # shorthand for mypy.ini: mypy.ini
      - pytest.ini: pytest.ini # format is target: source
      - ruff.toml

    # add more sources in the same format to sync from multiple repos
  - source: https://github.com/github/gitignore
    files:
      - .gitignore: Python.gitignore

  - source: https://github.com/licenses/license-templates
    files:
      - LICENSE: templates/mit.txt
  1. Install the mirror (make sure you've already run git init):
mirror install

For more advanced options, including using a remote config, see the help text:

mirror install --help

After installing, it's a good idea to commit.

  1. Periodically, sync your config files:
mirror sync

Make updates in the repos you're syncing from. You can still edit your local files manually, but you may need to resolve conflicts when you sync.

Pre-Commit

If you use, pre-commit, consider adding this repo as a hook to check for updates:

- repo: https://github.com/George-Ogden/mirror-rorrim/
  rev: v0.4.5
  hooks:
    - id: mirror-check

Contributing

Use GitHub for bugs/feature requests.

About

Sync configuration files across repos

Resources

License

Stars

Watchers

Forks

Languages