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

Re: subtree merging fails

From
Samuel Lijin <sxlijin@gmail.com>
Date
Feb 7, 2017, 14:59 UTC
Message-ID
<CAJZjrdU3toam4tDwXBu1Q3UAZm-kML3CzMrsMoJ_2jsGJ3vWrQ@mail.gmail.com>
In-Reply-To
<CAEXhnECi3LvSA92dSjL5PZ1Lx9p1PWELS04nmfJW=8K9o4T-0Q@mail.gmail.com>
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.
On Tue, Feb 7, 2017 at 2:16 AM, Stavros Liaskos <st.liaskos@gmail.com> wrote:
Show 22 quoted lines
> Following the instructions here:
> https://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging
> will lead to an error.
>
> In particular, if the subtree is merged and then updated, this command
> that is supposed to update the local subtree fails with a fatal:
> refusing to merge unrelated histories error.
>
> $ git merge --squash -s subtree --no-commit rack_branch
>
> A workaround could be using the --allow-unrelated-histories option
>
> $ git merge --squash --allow-unrelated-histories -s subtree
> --no-commit rack_branch
>
> But this completely destroys my project by pushing the subtree
> contents into a completely irrelevant directory in my project (no in
> the subtree).
>
> Any ideas??
>
> https://github.com/git/git-scm.com/issues/896#issuecomment-277587626
Previous: Stavros LiaskosNext: David Aguilar
Message 2 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.