Introducing git multi

Hiya there,

Did you ever need to manage a number of git repositories for your project? It can be cumbersome when the number of repositories you are dealing with day-to-day increases beyond a number. For eg, in my current day job, I am working with atleast 5 different git managed repositories. Now knowing which repository is in which state, and if the remote HEAD of the repos has diverged with the local, can become a bit painful to track if you have to cd into each of those directories and check for the status, or even poll for the latest changes. To avoid some of these common pitfalls, you might find git-multi (currently, tested only on Mac OS X), which is a pure shell utility useful.

For eg:

 $ git multi remote update
 $ git multi status
 $ git multi pull --rebase

Are all supported commands, which will first list out all the git managed repos within the current directory and will execute the command you specify, say 'status' on each of those repos. You can basically execute any git command on all the repos under the current directory.

For a simple installation, run:

 $ curl | sh

To manually do the above installation, you can follow the below steps:

 $ mkdir -p ~/bin
 $ curl > ~/bin/git-multi
 $ chmod 744 ~/bin/git-multi

And add the following to your shell load scripts (.bashrc/.bash_profile for Bash shell or .zshrc/.zprofile for Zsh shell).

export PATH=~/bin:$PATH

Of course, there is a built-in help to the command, which you can get lesser info using:

 $ git multi help

The code is currently being managed here. I guess at some point in time I would be moving it out of the current repo, and give it a proper repo, along with the other shell utils.

Latest Posts