DEV Community

Aliaksandr Valshtein
Aliaksandr Valshtein

Posted on

Git Extension to handle multiple repositories easily

GitHub logo tilalis / git-all

Git extension for simple multiple repositories management

git commands for all repositories located in the same folder

From my very first project to the project I work on now, I always had to handle multiple repositories.

Generally, it's a good idea to use submodules or subtrees, but usually whether use it or not is not up to you.

So I came up with a simple git extension to handle multiple repositories in bulk. I present to you git-all.

If you already have repo1 and repo2 in your folder, then executing

git all status

is an equivalent of

cd repo1
git status
cd ..

cd repo2
git status
cd ..

How to use it

All you need to do is just to prepend your regular git command with all. Yeah, that simple.

  • git all tag -a v1 -m "version one" tags all repositories current commit to tag v1 with message "version one"

  • git all push origin master pushes all current repositories states to the remote origin and branch master (you need to be careful with that)

  • git all {basically any other git command}

Cloning

The only different thing about git all is cloning, but, instead of repository name you just need to provide a file with repositories links, and that's all.

$ cat myrepo.list
https://github.com/stencila/test.git 
https://github.com/rtyley/small-test-repo.git
$ git all clone myrepo.list
# and now it's cloning multiple repositories

How it's different from similar extensions

Yet, there are a lot of similar extensions, one is myrepos, and on its page you can find a lot more in "related software" section, but git all is a little bit different from all of them:

  • It's just simple bash script similar to one many of you even wrote for yourself
  • It's zero-configuration, you don't need to register directories, create workspaces and configuration files
  • It's written in bash, so you don't need to use nodejs or python if you don't use it
  • You almost don't need to learn how to use it, it's just your regular git commands, just plus one word.

Links

Check README, there's a little more there!

A couple of questions for those who read it all

  • What do you use to handle multiple repositories?
  • Have you ever written a script for that?
  • Maybe, there is something really similar to what I did?
  • Do you like putting everything in a list as much as I do?

GitHub logo tilalis / git-all

Git extension for simple multiple repositories management

git all - simple multiple same folder repositories management

git commands for all repositories located in same folder

Cloning

The only special thing in git all is cloning In order to clone multiple repositories, you need to provide a file where every line is a valid set of arguments to reglar git clone

Let's say you have a file named repositories.list with the following content:

                  https://github.com/stencila/test.git renamedRepo
                  https://github.com/rtyley/small-test-repo.git
--branch gh-pages https://github.com/Samreay/WorkshopExample.git

If you execute git all clone repositories.list, as a result you will have the following folder structure:

renamedRepo/         # This folder will contain "test" repository, "master" branch
small-test-repo/     # This folder with contain "small-test-repo" repository, "master" branch
WorkshopExample      # This folder will contain "WorkshopExample" repository, "gh-pages" branch

Other Examples:

You can use whatever git command you want on multiple git repositories. All you need to do is to prepend it with all.

  • git all status shows git…

Top comments (0)