multi-git

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2020 License: MIT Imports: 5 Imported by: 0

README

GitHub tag (latest SemVer) GitHub Actions status

Multi-git

A little Go command-line program that manages a list of git repos and runs git commands on all repos.

Here is the usage statement

$ multi-git -h
Runs git commands over multiple repos.

It expects the git command to run as an argument.

For example:

multi-git status

If you want to specify multiple flags to git surround them with quotes:

multi-git 'status --short'

It also requires the following environment variables defined:
MG_ROOT: root directory of target git repositories
MG_REPOS: list of repository names to operate on

Usage:
  multi-git [flags]

Flags:
      --config string   config file path (default is $HOME/multi-git.toml)
  -h, --help            help for multi-git
      --ignore-errors   will continue executing the command for all repos if ignore-errors is true
                        otherwise it will stop execution when an error occurs

Config file

The multi-git config file looks like:

root = "~/git"
repos = "repo-1,repo-2"

The file is required. You can override the values with the environment variables per run.

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.

Makefile

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:

$ make
Available targets:

help            This help screen
build           Build multi-git and inject the git tag and build time to variables in main
install         Install multi-git into /usr/local/bin (avoid standard go install)
unit-tests      Run only the unit tests
e2e-tests       Run only the end to end tests
test            Run all the tests
ginkgo-test     Run all the tests with ginkgo
docker-build    Dockerize multi-git
docker-push     Push multi-git to DockerHub (requires DockerHub account)

Multi-git v0.1

This initial release of multi-git supports the TutsPlus article: Let's Go: Command-line Programs with Golang.

Note: there is no Makefile available for multi-git v0.1.

Command-line Arguments

It accepts two command-line arguments:

  • --command : the git command (wrap in double quotes for multi-arguments commands)
  • --ignore-errors: keeps going through the list of repos even the git command failed on some of them

Environment variables

The list of repos is controlled by two the environment variables:

  • MG_ROOT : the path to a root directory that contains all the repos
  • MG_REPOS : the names of all managed repos under MG_ROOT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL