Merge one Git project into a completely different one

At work we have some tooling done in .NET but like all compiled languages it is highly inflexible when you need to quickly hack up a simple tool for a one time job. After hearing my coworker rave about Python I decided to slowly transition to it in order to add the missing flexibility. A couple of days ago I needed to upgrade on of the tools which was in an especially poor state so as an excercise I started doing it in Python.

Originally I thought it would take me too long to come up with something useful but one thing led to another and all of a sudden I had an application which by far surpassed the poorly implemented one. I had my Python code in a separate Git repository from our tooling repository since I didn’t really expect it to turn into something useful but now I realized that the value of the new tool really warranted it to be imported and to superceed the old one. The problem I was faced with now was how to import my Git repo into the central tooling repo without losing its history.

After spending a while googling and just getting hits on how to use git-cvs or git-svn to “import” or “merge” your existing cvs/svn repo into a shiny new Git repo I decided to go to #git for some local help. There the user Ilari pointed me to in the right direction which was to use a Git subtree merge strategy. Googling that I immediately found “How to use the subtree merge strategy” which was precisely the solution I was looking for!

So far I have not found a single use case that I needed which Git doesn’t already cover.