* subtree merging fails
@ 2017-02-06 8:48 Stavros Liaskos
2017-02-06 17:08 ` Johannes Schindelin
0 siblings, 1 reply; 6+ messages in thread
From: Stavros Liaskos @ 2017-02-06 8:48 UTC (permalink / raw)
To: git
Hi,
Please check this issue for a description of the bug:
https://github.com/git/git-scm.com/issues/896#issuecomment-277587626
Regards,
Stavros
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: subtree merging fails
2017-02-06 8:48 Stavros Liaskos
@ 2017-02-06 17:08 ` Johannes Schindelin
0 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2017-02-06 17:08 UTC (permalink / raw)
To: Stavros Liaskos; +Cc: git
Hi Stavros,
On Mon, 6 Feb 2017, Stavros Liaskos wrote:
> Please check this issue for a description of the bug:
> https://github.com/git/git-scm.com/issues/896#issuecomment-277587626
Just an observation from my side: if I see a request for help on this
mailing list where the sender merely pastes a link and does not bother to
condense and summarize the information in the linked page, to help
potential helpers, I am highly unlikely to even click on that link, let
alone to try to help.
Maybe you would want to spend as much effort on a request for help as you
would like to ask people to spend on a reply?
Ciao,
Johannes
^ permalink raw reply [flat|nested] 6+ messages in thread
* subtree merging fails
@ 2017-02-07 8:16 Stavros Liaskos
2017-02-07 14:59 ` Samuel Lijin
0 siblings, 1 reply; 6+ messages in thread
From: Stavros Liaskos @ 2017-02-07 8:16 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: subtree merging fails
2017-02-07 8:16 subtree merging fails Stavros Liaskos
@ 2017-02-07 14:59 ` Samuel Lijin
2017-02-07 18:44 ` David Aguilar
0 siblings, 1 reply; 6+ messages in thread
From: Samuel Lijin @ 2017-02-07 14:59 UTC (permalink / raw)
To: Stavros Liaskos; +Cc: git@vger.kernel.org
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:
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: subtree merging fails
2017-02-07 14:59 ` Samuel Lijin
@ 2017-02-07 18:44 ` David Aguilar
2017-02-08 10:42 ` Stavros Liaskos
0 siblings, 1 reply; 6+ messages in thread
From: David Aguilar @ 2017-02-07 18:44 UTC (permalink / raw)
To: Samuel Lijin; +Cc: Stavros Liaskos, git@vger.kernel.org
On Tue, Feb 07, 2017 at 08:59:06AM -0600, Samuel Lijin wrote:
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: subtree merging fails
2017-02-07 18:44 ` David Aguilar
@ 2017-02-08 10:42 ` Stavros Liaskos
0 siblings, 0 replies; 6+ messages in thread
From: Stavros Liaskos @ 2017-02-08 10:42 UTC (permalink / raw)
To: David Aguilar; +Cc: Samuel Lijin, git@vger.kernel.org
@Samuel Lijin
I tried now and I get:
"merge: branch_name
- not something we can merge".
Maybe that is something easy to fix but currently I am using a
workaround script so I am not putting any more effort at this at the
moment.
@David Aguilar
That's true but the trailing slash is already there. This commands
looks promising. An update would be GREAT!
FYI that's the script I am using to address this problem:
#!/bin/bash
function initial {
if git remote | grep -q lisa_remote
then
echo "Subtree delete & update"
git checkout lisa_branch
git pull
git checkout master
git merge --squash -s subtree --no-commit lisa_branch
git merge --squash --allow-unrelated-histories -s subtree
--no-commit lisa_branch
else
echo "Add subtree"
git remote add lisa_remote git@xxxxxxxx:lisa/lisa.git
git fetch lisa_remote
git checkout -b lisa_branch lisa_remote/master
git checkout master
git read-tree --prefix=lisaSubTree/ -u lisa_branch
gitrm
git rm --cached -r lisaSubTree/.gitignore
git rm --cached -r lisaSubTree/*
fi
}
initial
On Tue, Feb 7, 2017 at 7:44 PM, David Aguilar <davvid@gmail.com> wrote:
> On Tue, Feb 07, 2017 at 08:59:06AM -0600, Samuel Lijin wrote:
>> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-02-08 10:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 8:16 subtree merging fails Stavros Liaskos
2017-02-07 14:59 ` Samuel Lijin
2017-02-07 18:44 ` David Aguilar
2017-02-08 10:42 ` Stavros Liaskos
-- strict thread matches above, loose matches on Subject: below --
2017-02-06 8:48 Stavros Liaskos
2017-02-06 17:08 ` Johannes Schindelin
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).