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

Re: Question about pre-merge and git merge octopus strategy

From
ZheNing Hu <adlternative@gmail.com>
Date
May 11, 2022, 11:21 UTC
Message-ID
<CAOLTT8R7QmpvaFPTRs3xTpxr7eiuxF-ZWtvUUSC0-JOo9Y+SqA@mail.gmail.com>
In-Reply-To
<CABPp-BEFYjTvK4ZNSg+yiahRAzXW=KU11a-b+QRdcBDGb-movQ@mail.gmail.com>
Elijah Newren <newren@gmail.com> 于2022年5月10日周二 15:07写道:
Show 32 quoted lines
>
> On Sun, May 8, 2022 at 7:44 AM ZheNing Hu <adlternative@gmail.com> wrote:
> >
> > Elijah Newren <newren@gmail.com> 于2022年5月7日周六 12:09写道:
> > >
> > > On Fri, May 6, 2022 at 10:24 AM Christian Couder
> > > <christian.couder@gmail.com> wrote:
> > > >
> > > > On Fri, May 6, 2022 at 10:15 AM ZheNing Hu <adlternative@gmail.com> wrote:
> [...]
> > > > > I think it's not useful for git merge-octopus, because if we meet a
> > > > > merge conflict, we can't find
> > > > > MERGE_HEAD at all! How can we abort this conflict merge?
> > >
> > > MERGE_HEAD doesn't have anything to do with aborting the conflict
> > > resolution step.  When you need to abort, the thing you want to go
> > > back to is HEAD (which represents the commit you had checked out and
> > > were merging the other stuff into), not MERGE_HEAD (which represents
> > > the branch or branches you were merging into HEAD).
> > >
> >
> > Thanks for clarifying. As I reply to Christian, when I just use "git
> > merge A B C" happily,
> > and there is a conflict, so I try "git merge --abort" as usual, but it
> > can not work... git tell me:
> >
> > fatal: There is no merge to abort (MERGE_HEAD missing).
>
> Sounds like a bug to me; .git/MERGE_HEAD should be written.  That file
> is created for me when I set up a simple octopus merge that has
> conflicts.  Do you have a set of steps others can use to reproduce the
> problem you are seeing?
Let me minimally reproduce this question (with git 2.33.0):
#!/bin/bash

rm -rf test-repo git init test-repo cd test-repo git branch -m main echo base > base git add . git commit -m "base" git branch -c dev-1 git branch -c dev-2 echo main > main git add . git commit -m "main change" git checkout dev-1 echo dev-1 >> base git add . git commit -m "dev-1 change" git checkout dev-2 echo dev-2 >> base git add . git commit -m "dev-2 change" git checkout main echo main >> base git add . git commit -m "main change" git merge dev-1 dev-2 file .git/MERGE_HEAD

which output:
.git/MERGE_HEAD: cannot open `.git/MERGE_HEAD' (No such file or directory)
Previous: Elijah NewrenNext: Elijah Newren
Message 7 of 15 in “Question about pre-merge and git merge octopus strategy”
  1. ZheNing HuMay 6, 2022
  2. Christian CouderMay 6, 2022
  3. Elijah NewrenMay 7, 2022
  4. Junio C HamanoMay 7, 2022
  5. ZheNing HuMay 8, 2022
  6. Elijah NewrenMay 10, 2022
  7. ZheNing HuMay 11, 2022
  8. Elijah NewrenMay 12, 2022
  9. Junio C HamanoMay 12, 2022
  10. Elijah NewrenMay 13, 2022
  11. Junio C HamanoMay 13, 2022
  12. ZheNing HuMay 19, 2022
  13. Elijah NewrenMay 19, 2022
  14. ZheNing HuMay 8, 2022
  15. Carlo Marcelo Arenas BelónMay 8, 2022

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.