github.com/the-gigi/multi-git@v1.0.0/README.md (about)

     1  [![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/the-gigi/multi-git.svg?label=release)](https://github.com/the-gigi/multi-git/releases)
     2  <a href="https://github.com/the-gigi/multi-git/actions"><img alt="GitHub Actions status" src="https://github.com/the-gigi/multi-git/workflows/Go/badge.svg"></a> 
     3  
     4  # Multi-git
     5  
     6  A little Go command-line program that manages a list of git repos and runs git commands on all repos.
     7  
     8  Here is the usage statement
     9  ```
    10  $ multi-git -h
    11  Runs git commands over multiple repos.
    12  
    13  It expects the git command to run as an argument.
    14  
    15  For example:
    16  
    17  multi-git status
    18  
    19  If you want to specify multiple flags to git surround them with quotes:
    20  
    21  multi-git 'status --short'
    22  
    23  It also requires the following environment variables defined:
    24  MG_ROOT: root directory of target git repositories
    25  MG_REPOS: list of repository names to operate on
    26  
    27  Usage:
    28    multi-git [flags]
    29  
    30  Flags:
    31        --config string   config file path (default is $HOME/multi-git.toml)
    32    -h, --help            help for multi-git
    33        --ignore-errors   will continue executing the command for all repos if ignore-errors is true
    34                          otherwise it will stop execution when an error occurs
    35  ```
    36  
    37  # Config file
    38  
    39  The multi-git config file looks like:
    40  
    41  ```
    42  root = "~/git"
    43  repos = "repo-1,repo-2"
    44  ```
    45  
    46  The file is required. You can override the values with the environment variables per run.
    47  
    48  If you specify the `--config <config file>` multi-git will read that file otherwise it will expect it to be in the default location: `$HOME/multi-git.toml`.
    49  
    50  # Makefile
    51  
    52  Multi-git has a Makefile that lets you build, install, test, create docker image and push the docker image to DockerHub. Type `make` to see this help screen:
    53  
    54  ```
    55  $ make
    56  Available targets:
    57  
    58  help            This help screen
    59  build           Build multi-git and inject the git tag and build time to variables in main
    60  install         Install multi-git into /usr/local/bin (avoid standard go install)
    61  unit-tests      Run only the unit tests
    62  e2e-tests       Run only the end to end tests
    63  test            Run all the tests
    64  ginkgo-test     Run all the tests with ginkgo
    65  docker-build    Dockerize multi-git
    66  docker-push     Push multi-git to DockerHub (requires DockerHub account)
    67  ```
    68  
    69  # Multi-git v0.1
    70  
    71  This [initial release](https://github.com/the-gigi/multi-git/releases/tag/v0.1) of multi-git supports the TutsPlus article: [Let's Go: Command-line Programs with Golang](https://code.tutsplus.com/tutorials/lets-go-command-line-programs-with-golang--cms-26341).
    72  
    73  Note: there is no Makefile available for multi-git v0.1.
    74  
    75  ## Command-line Arguments
    76  It accepts two command-line arguments:
    77  
    78  * --command : the git command (wrap in double quotes for multi-arguments 
    79  commands)
    80  * --ignore-errors: keeps going through the list of repos even the git command
    81   failed on some of them
    82  
    83  ## Environment variables
    84  The list of repos is controlled by two the environment variables:
    85  
    86  * MG_ROOT : the path to a root directory that contains all the repos
    87  * MG_REPOS : the names of all managed repos under MG_ROOT