Managing a collection of git repositories


A small post to point out the existence of myrepos.

This tool allows you to manage a collection of git repositories.

Quoted from the official site:

You have a lot of version control repositories. Sometimes you want to update them all at once. Or push out all your local changes. You use special command lines in some repositories to implement specific workflows. Myrepos provides a mr command, which is a tool to manage all your version control repositories.

Imagine that you have several git projects ~/GitLab/project_A and ~/GitHub/project_B, etc…

Using mr is really easy. Simply register your projects:

cd
mr register GitLab/project_A
mr register GitHub/project_B

and that’s it!

Note: you can see your registered repos in the ~/.mrconfig configuration file.

Now you can perform operations like status, update or push for all your repositories in one command line.

mr status
mr status: /home/picaud/GitLab/project_A

mr status: /home/picaud/GitHub/project_B

mr status: finished (2 ok)

If you modify some files:

cd /home/picaud/GitHub/project_B 
echo "some text" > another_file.cpp
git add another_file.cpp

then

cd 
mr status

will print:

mr status: /home/picaud/GitLab/project_A

mr status: /home/picaud/GitHub/project_B
A  another_file.cpp

mr status: finished (2 ok)

If you want to push everything (well, this is not a good practice):

cd 
mr commit -a -m "must leave the office in emergency..."

this will commits changes and push all your repos to their remotes.

Attention for the git users: the mr commit ... is equivalent to the two git operations: git commit ... followed by a git push. With mr, if you want to proceed step by step, use:

mr record -m "a commit message"
mr push

A very convenient command I ritually do every starting work day is:

cd 
mr update

this will update (fetch + pull) all your repos in one command line!

Note:

  • mr is available as a Debian package
  • is compatible with several versioning systems like git, svn, hg
  • here is the available commands (from mr manpage):
       mr [options] checkout

       mr [options] update

       mr [options] status

       mr [options] clean [-f]

       mr [options] commit [-m "message"]

       mr [options] record [-m "message"]

       mr [options] fetch

       mr [options] push

       mr [options] diff

       mr [options] log

       mr [options] grep pattern

       mr [options] run command [param ...]

       mr [options] bootstrap src [directory]

       mr [options] register [repository]

       mr [options] config section ["setting=[value]" ...]

       mr [options] action [params ...]

       mr [options] [online|offline]

       mr [options] remember action [params ...]

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.