Multi-Gitter: The Ultimate Tool for Synchronized Changes Across Repositories

Apr 8, 2024 | Programming

Multi-gitter logo

**Multi-Gitter** allows you to make changes in multiple repositories simultaneously. This is achieved by running a script or program in the context of multiple repositories. If any changes are made, a pull request is created that can be merged manually by the set reviewers, or automatically by Multi-Gitter when CI pipelines have completed successfully. Are you a bash-guru or simply prefer your scripting in Node.js? It doesn’t matter, since Multi-Gitter supports any type of script or program. If you can script it to run in one place, you can run it in all your repositories with one command!

Use Cases

Multi-Gitter can be used for a variety of tasks including:

  • Syncing a file (like a PR-template)
  • Programmatic refactoring
  • Updating a dependency
  • Automatically fixing linting issues
  • Search and replace
  • Anything else you are able to script!

Demo

![Demo GIF](docs/img/demo.gif)

Running Scripts with Multi-Gitter

To get started, you need to run scripts using Multi-Gitter. Here’s how:

Run with a File

Use the following command format to run a script:

bash
$ multi-gitter run .my-script.sh -O my-org -m "Commit message" -B branch-name

Make sure the script has execution permissions before running it:

bash
chmod +x .my-script.sh

Run Code Through an Interpreter

If you are running an interpreted language, it’s important to specify the path as an absolute value (since the script will be executed in each repository’s context). You can use the $PWD variable to help with this:

bash
$ multi-gitter run python $PWD/run.py -O my-org -m "Commit message" -B branch-name
$ multi-gitter run node $PWD/script.js -R repo1 -R repo2 -m "Commit message" -B branch-name
$ multi-gitter run go run $PWD/main.go -U my-user -m "Commit message" -B branch-name

Test Before Live Run

Want to test your changes without creating commits? Use the –dry-run flag:

bash
$ multi-gitter run .script.sh --dry-run --log-level=debug -O my-org -m "Commit message" -B branch-name

Installation

Using Homebrew

If you are using Mac or Linux, [Homebrew](https://brew.sh) makes it easy to install Multi-Gitter:

bash
brew install lindell/multi-gitter/multi-gitter

Manual Binary Install

Find the binary for your operating system from the release page and download it.

Automatic Binary Install

To automatically install the latest version, use:

bash
curl -s https://raw.githubusercontent.com/lindell/multi-gitter/master/install.sh | sh

From Source

You can also install from source with Go:

bash
go install github.com/lindell/multi-gitter@latest

Configuration

All configuration in Multi-Gitter can be managed through command line flags, configuration files, or a combination of both. If you want to use a configuration file, simply use the –config=.path/to/config.yaml option.

Configuration File Example

The priority of configs is as follows:

  • Flags
  • Defined config file
  • Static config file

Troubleshooting

In case you run into issues, here are some troubleshooting tips:

  • Ensure your script has the correct execution permissions.
  • Check your token and access permissions on your repositories.
  • If you encounter errors while testing, try adjusting the logging level to debug for more insights.
  • For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox