mr utility (a.k.a.,
myrepos) provides an outstanding solution to this very problem. Install it using your favorite package manager, or just grab the
mr script directly from github and put it in
$HOME/bin or somewhere else on your
cd to the parent
plugins folder shared by these repos and create a basic
.mrconfig file with contents similar to the following (adjusting the URLs as needed):
# File: .mrconfig [cms] checkout = git clone 'https://<username>@github.com/<username>/cms' 'cms' [admin] checkout = git clone 'https://<username>@github.com/<username>/admin' 'admin' [chart] checkout = git clone 'https://<username>@github.com/<username>/chart' 'chart'
After that, you can run
mr up from the top level
plugins folder to pull updates from each repository. (Note that this will also do the initial clone if the target working copy doesn’t yet exist.) Other commands you can execute include
mr diff, etc—run
mr help to see what’s possible. There’s a
mr run command that acts as a pass-through, allowing you to access VCS commands not directly suported by
mr itself (e.g.,
mr run git tag STAGING_081220015). And you can even create your own custom commands that execute arbitrary bits of shell script targeting all repos!
mr is an extremely useful tool for dealing with multiple repos. Since the
plugins folder is in your home directory, you might also be interested in
vcsh. Together with
mr, it provides a powerful mechanism for managing all of your configuration files. See this blog post by Thomas Ferris Nicolaisen for an overview.