A simple command-line tool designed to automate repetitive Git workflows across multiple Github repositories.
Common tasks like cloning repositories and performing commits occur in parallel, while pull requests are dynamically generated - enabling you to ship changes at lightning speed. ⚡
Before using gmux, make sure you have the required dependencies installed:
# brew install git
git --version
# brew install gh
gh --version
Install gmux using the following command:
pip3 install https://github.com/samlader/gmux/archive/refs/tags/v0.2.1.zip
Use the init command to create a new working directory for gmux, along with a pull request template:
gmux init --directory=<directory_name>
Clone all repositories from a specified GitHub organization or user:
gmux clone --org=<organization_or_user> [--filter=<regex_filter>]
Execute any Git command for all repositories. Dynamic variables for each repository can be used.
gmux git [GIT_COMMAND] [--filter=<regex_filter>]
-
@default
(default branch of a repository) -
@current
(current branch of the repository)
Create pull requests for each repository:
gmux pr
Pull requests use the template (PR_TEMPLATE.md
) created in the root directory by default.
Templates support Jinja expressions and the following context variables are provided:
repository_name
(name of the repository)diff_files
(files with changes against the base branch)
Templates support LLM-based text generation using the ollama_chat
macro.
This macro requires a local installation of ollama and accepts two arguments:
model
(name of the model, all available models can be found here)prompt
(text prompt given to the model)
## Overview
This PR contains {{ diff_files|length }} changes for {{ repository_name }}.
{% if "README.md" in diff_files %}
The documentation has been updated to reflect these changes accordingly.
{% endif %}
{{ ollama_chat("llama3", "Write some guidelines on the usage of React hooks") }}
## Changes
{% for diff_file in diff_files %}
- {{ diff_file }}
{% endfor %}
Execute a command in each repository. Useful for batch operations across multiple projects.
gmux cmd [COMMAND] [--filter=<regex_filter>]
# Initialize a new directory
gmux init
# Clone service repositories from the organization "example-org"
gmux clone --org=example-org --filter="*-service"
# Create a new branch on all repositories
gmux git checkout -b feature-branch
# Run codemod across all repositories
codemod -m --extensions html \
'<font *color="?(.*?)"?>(.*?)</font>' \
'<span style="color: \1;">\2</span>'
# Commit changes
gmux git commit -m "Implement new feature"
# Create pull requests for all repositories
gmux pr
Contributions and bug reports are welcome! Feel free to open issues, submit pull requests or contact me if you need any support.
This project is licensed under the MIT License.