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

Re: subtree merging fails

From
David Aguilar <davvid@gmail.com>
Date
Feb 7, 2017, 18:44 UTC
Message-ID
<20170207184437.c6uuuxcmhi434vbc@gmail.com>
In-Reply-To
<CAJZjrdU3toam4tDwXBu1Q3UAZm-kML3CzMrsMoJ_2jsGJ3vWrQ@mail.gmail.com>
On Tue, Feb 07, 2017 at 08:59:06AM -0600, Samuel Lijin wrote:
Show 12 quoted lines
> Have you tried using (without -s subtree) -X subtree=path/to/add/subtree/at?
> 
> From the man page:
> 
>           subtree[=<path>]
>                This option is a more advanced form of subtree
> strategy, where the strategy
>                makes a guess on how two trees must be shifted to match
> with each other when
>                merging. Instead, the specified path is prefixed (or
> stripped from the
>                beginning) to make the shape of two trees to match.

I'm not 100% certain, but it's highly likely that the subtree=<prefix> argument needs to include a trailing slash "/" in the prefix, otherwise files will be named e.g. "fooREADME" instead of "foo/README" when prefix=foo.

These days I would steer users towards the "git-subtree" command in contrib/ so that users don't need to deal with these details. It handles all of this stuff for you.

https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt
https://github.com/git/git/tree/master/contrib/subtree

Updating the progit book to also mention git-subtree, in addition to the low-level methods, would probably be a good user-centric change.

-- 
David
Previous: Samuel LijinNext: Stavros Liaskos
Message 3 of 4 in “subtree merging fails”
  1. Stavros LiaskosFeb 7, 2017
  2. Samuel LijinFeb 7, 2017
  3. David AguilarFeb 7, 2017
  4. Stavros LiaskosFeb 8, 2017

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.