git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: subtree merge tries to merge into wrong directory

From
David Aguilar <davvid@gmail.com>
Date
Dec 10, 2009, 04:20 UTC
Message-ID
<20091210042008.GA3398@gmail.com>
In-Reply-To
<4B206DCF.90202@naderman.de>
On Thu, Dec 10, 2009 at 04:41:03AM +0100, Nils Adermann wrote:
Show 42 quoted lines
> Following  
> http://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html 
> I have subtree merged a 3rd party library (ezc-reflection) into my  
> repository (pflow). The prefix I used was lib/ezc/trunk/Reflection. Now  
> there have been changes to ezc-reflection but merging them into my  
> repository fails. The merge is attempted in example/ rather than  
> lib/ezc/trunk/Reflection.
>
> I originally set this up with:
>
> git remote add -f ezc-reflection /path/to/ezc-reflection
> git merge -s ours --no-commit ezc-reflection/master
> git read-tree --prefix=lib/ezc/trunk/Reflection -u ezc-reflection/master
>
> Reproduce my problem by executing the following:
>
> git clone git://github.com/naderman/pflow.git
> cd pflow
> git reset --hard f3e001e3
> git fetch git://github.com/naderman/ezc-reflection.git master
> git merge -s subtree FETCH_HEAD
>
> As you see this results in:
>
> CONFLICT (delete/modify): example/src/doc_comment_parser.php deleted in  
> HEAD and modified in FETCH_HEAD. Version FETCH_HEAD of  
> example/src/doc_comment_parser.php left in tree.
> Automatic merge failed; fix conflicts and then commit the result.
>
> As long as I don't make any changes to lib/ezc/trunk/Reflection that I  
> want to merge I can work around this by simply repeating my original  
> process like this:
>
> git clone git://github.com/naderman/pflow.git
> cd pflow
> git reset --hard f3e001e3
> git fetch git://github.com/naderman/ezc-reflection.git master
> git merge -s ours --no-commit FETCH_HEAD
> git rm -r lib/ezc/trunk/Reflection/
> git read-tree --prefix=lib/ezc/trunk/Reflection/ -u FETCH_HEAD
>
> Why does this problem occur and how can I get the merge to work properly?

I'm not sure, but maybe you can try git-subtree? It makes this stuff easier for mere mortals.

http://github.com/apenwarr/git-subtree/

You might need to start redo your repo, but several people have had good success with git-subtree.

-- 
		David
Previous: Nils AdermannNext: Nils Adermann
Message 2 of 6 in “subtree merge tries to merge into wrong directory”
  1. Nils AdermannDec 10, 2009
  2. David AguilarDec 10, 2009
  3. Nils AdermannDec 10, 2009
  4. Avery PennarunDec 10, 2009
  5. naderman@naderman.deDec 16, 2009
  6. Nils AdermannJan 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.