Merging/joining two repos (repo2 should be a subdirectory of repo1)

From: Dirk Süsserott <hidden>
Date: 2016-06-15 22:54:54

Hi!

I have repo1 with ~4 years of history and another repo2 with ~1 year of
history, both of which I don't want to loose. Now I want to join them so
that repo2 becomes a subdirectory whithin repo1, including all the
history of repo2.

A simple git-merge won't do because both repos have some same files (at
least e.g. .gitignore) in their root directories. Of course I could
resolve the conflicts, but I don't want that.

My naive approach is "move everything in $repo2 one directory below" and
then "merge $repo2 into $repo1". Actually I wouldn' call that a "merge"
but an "import".

I know of "git filter-branch --subdirectory-filter foodir" but that's
just the opposite of what I need.

Is there a nifty trick to get this? Or will I have to do "git
filter-branch --tree-filter 'mkdir subdir && git mv * subdir' --all" on
$repo2 and then "git merge $repo2" in $repo1?

Thanks in advance
Dirk
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help