views:

45

answers:

1

I'm trying to convert an old CVS repository tracking a vendor branch to git, and I'm running into a merge issue.

The repository is structured like this:

dir1/
dir2/

dir2 comes from the upstream branch. Upstream converted to git already, and dir2 in our repo is the root of their git repo. I want to add them as a remote and merge their root into the subdirectory dir2.

Simple merging won't work: git treats their root as our root and finds no files in common.

Subtree merging won't work: you can't subtree merge into an existing directory. I followed the How to use the subtree merge strategy guide, and this command fails:

git read-tree --prefix=dir2/ -u upstream/master

The problem is that it detects 'conflicting' files that already exist in dir2. I know the files exist, I want it to merge those files.

Any advice would be appreciated.

A: 

The trick is to do a normal recursive merge with the subtree option:

git merge -s recursive -Xsubtree=dir2 upstream/master
Mike Ryan