Am 30.09.2012 22:44 schrieb David Aguilar:
> On Sun, Sep 30, 2012 at 8:32 AM, Dirk Süsserott <> 
> wrote:
>> Am 30.09.2012 17:24 schrieb Tomas Carnecky:
>>> On Sun, 30 Sep 2012 17:17:53 +0200, Dirk SÃŒsserott 
>>> <> wrote:
>>>> 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?
>> Wow! Thanks for that quick and *very* helpful answer! :-)
> Hi Dirk,
> You should also take a look at contrib/subtree/ in the git source tree.
> "git subtree" does pretty much exactly what you're looking to do,
> and it is a bit more user-friendly than the plumbing commands.

Hi David,

thanks for the pointer. I know of subtree and like it. But for my case
I'll stick to the plumbing commands because I really want to *import*
$repo2 into $repo1 and then delete $repo2. One shot.

(Actually I re-wrote a part of our project just for fun and didn't do it
in the main project's repo in a separate branch (as I normally do) but
in a totaly separate repo. And now it turned out that my rewritten part
is really cool and we want to include it in the main $repo1 and drop my
private $repo2.)


To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to