Re: Question about pre-merge and git merge octopus strategy
- From
Christian Couder <christian.couder@gmail.com>
- Date
- May 6, 2022, 17:23 UTC
- Message-ID
- <CAP8UFD2p+Evqv_MBAgv23zooppsNWjOw6ZU2GLqAq_skZoJPOw@mail.gmail.com>
- In-Reply-To
- <CAOLTT8S8rh+VYcuaqBeNtmphiRqw7HropLFpkxfnTJq6BngGXw@mail.gmail.com>
Hi,
On Fri, May 6, 2022 at 10:15 AM ZheNing Hu <adlternative@gmail.com> wrote:
Show 7 quoted lines
> I am thinking about if git can "pre-merge" multiple branches, which > can check if merge > will have conflict, but not to merge them actually, like a option `--intend`. > > I find "git merge-tree" can output merge result in stdout, which meets > my needs, but it can only > support two branches' merge.
Elijah (added in Cc) has been working on "git merge-tree" improvements based on the new "ort" merge he developed. It supports merging 2 branches, but maybe there are ways to make it support more than 2.
> So I find git merge with more than two branches can use octopus strategy. > What about git merge --no-commit? Which will not commit automatically, > so we can check if they have > confilct, and abort merge.
Yeah, I think that's what you want.
> 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?
I don't know octopus merges much, but I think you should be able to abort using "git reset" (maybe with "--hard"). If the merge was performed using --no-commit or if there was a conflict, then I think it should be expected that there is no MERGE_HEAD as no commit would be created so MERGE_HEAD would have nothing to point to.