A Fresh Cup is Mike Gunderloy's software development weblog, covering Ruby on Rails and whatever else I find interesting in the universe of software. I'm a full-time Rails developer and contributor, available for long- or short-term consulting, with solid experience in working as part of a distributed team. If you'd like to hire me, drop me a line. I'm also the author of Rails Rescue Handbook and Rails Freelancing Handbook.

Navigation

A Fresh Cup

Notes on Rails and other development

Saturday
Sep192009

Push to Multiple Git Repos

If you've got a project with multiple git remotes, and you'd like to update both of them with a single operation, there's an easy way to do it. Just edit your .git/config file to include a new target named "all":

[sourcecode language='ruby']
[remote "origin"]
url = git@github.com:ffmike/BigOldRailsTemplate.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "codaset"]
url = git@codaset.com:ffmike/bigoldrailstemplate.git
fetch = +refs/heads/*:refs/remotes/codaset/*
[remote "all"]
url = git@github.com:ffmike/BigOldRailsTemplate.git
url = git@codaset.com:ffmike/bigoldrailstemplate.git
[/sourcecode]

With this setup, pushes and pulls on my local master branch go to GitHub by default. But if I execute 'git push all' it updates both the GitHub repository and the Codaset repository. The one little annoyance is that master then thinks it's ahead of the remote, but that's easily remedied by executing a 'git pull' on it.

I've been using this in cases where I'm backing up a repo to a private Gitosis server as well as spreading public repos between multiple cloud services for easy backup.
Thursday
Sep172009

Double Shot #543

Not much happening today.

Thursday
Sep172009

Double Shot #542

Another quiet morning in the code farm.

Tuesday
Sep152009

Double Shot #541

I can only imagine how much work I could get done without four kids to ferry around.

Monday
Sep142009

Double Shot #540

All work and no surf makes for a short post.