Multi Git
A Git command line to manage multiple git repositories at once.
Intended use
If you ever worked in a micro service environment, you've most likely been asked to worked with dozen of projects. Keeping them up to date tends to be tedious.
This module aims to replace this :
$ cd group/project1$ git pull$ cd ../project2$ git pull$ cd ../project3$ git pull$ cd ../project4$ git pull$ cd ../project5$ git pull...
by that :
$ cd group$ multi-git pull
same goes for status, fetch ...
Configuration
multi-git will try to read its configuration file from multiple locations in the following order:
- the current working directory
- the home directory
- the module directory (which will most likely serve as default values)
This file must be named .mg-config.json
and be in json
format.
- Paths can be absolute or relative.
- If relative, they will be resolved from the current working directory.
- Paths can contain ~
- A project can belong to multiple groups
About allowEmptyRelease
By default, if you attemp to run multi-git release start on a group, it will run git flow release start for each project, wether or not develop is ahead of master. Wich means you could create empty release. A group with allowEmptyRelease set to false, will skip such directories.
Available commands
$ multi-git -hmulti-git <command> [options] Commands: status Run git status
Behaviour
You can use multi-git:
- with the --group flag: In that case multi-git will try to find the group by its name in the configuration file and run the specified command on each group member.
- with the --project flag: In that case multi-git will try to find the project by its name in the configuration file and run the specified command.
- without either of those:
- if
config.defaultToProject === true
: multi-git will run the specified command in the current working directory, just like git would. - otherwise:
- if the current working directory is a git repository, multi-git will run the specified command on each member of each group the cwd belongs ;
- if not, it will run the command on each subdirectories of the cwd.
- if
Want to contribute?
Any idea to improve this project would be greatly appreciated. Feel free to submit your pull request.