Updating tons of git repositories made easy

With git being the awesome version control system that it is, I switched to using git-svn for all our Web-Empowered Church extensions. That way I get the easy branching and merging while still being compatible with Subversion and everyone else who’s using it (and who hasn’t seen the light yet…).

Now I have a directory that contains all our wec_* extensions. With Subversion, I could do a simple “svn up *” and it would update all the working copies inside the subdirectories. Unfortunately, git doesn’t do that.

Ruby to the rescue:

!/usr/bin/env ruby

def rebase(dir) Dir.chdir(dir) do |path| puts "Rebasing #{path}...." git svn rebase puts "done!\n\n" end end

if ARGV[0].nil? dirs = Dir["*/"] dirs.each do |dir| rebase(dir) end else rebase ARGV[0] end

Just stuck this into the directory above all the extensions. Now I can rebase all extensions automatically with one little command, or just one by giving an optional argument.

No related posts.

2 thoughts on “Updating tons of git repositories made easy

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>