Rob Williams is a probabilistic Lean coder of Java and Objective-C. Rob is a DZone MVB and is not an employee of DZone and has posted 170 posts at DZone. You can read more from them at their website. View Full User Profile

Merging a Number of Git Projects Into One

05.26.2011
| 3898 views |
  • submit to reddit

The question of why and how git is so flexible is a really interesting one. Is it a consequence of its having been around for so long? Or that it was forged, as it were, at the hands of people who were doing real, large projects (e.g. Linux)? I have argued here before that after using Git for a very short amount of time, the idea of going back to subversion is ludicrous. The main reason for that is that you will develop facility with the tool very rapidly, which is really important: when you have a tool to use, you are either going to get your lashes burned off a few times, and will continue on, like someone who‘s stooping in a mudpuddle waiting for the next shelling to begin, or you will actually feel the inputs produce consistent outcomes. Git gets a 10 on this score.

Anyway, I got to the point where I wanted to change our current project, taking it from a bunch of disparate projects to one project with a bunch of subprojects. It‘s finally possible with m2 in eclipse. The problem was moving the code without losing history. A dude on StackOverflow had the answer. I made a shell script out of it that you can download here.

Git Documentation on Subtree Merges

 

From http://www.jroller.com/robwilliams/entry/merging_a_number_of_git

Published at DZone with permission of Rob Williams, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)