我怎样才能制作一个复杂的章鱼合并? [英] How can I make a complex octopus merge?

查看:149
本文介绍了我怎样才能制作一个复杂的章鱼合并?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是提出了8种不同的建议,并且希望提交将所有这些建议合并在一起。我通过逐个手动解决合并冲突(然后用 git merge --squash )将它们压缩在一起来完成合并,但现在,当我尝试使用进行章鱼合并提交git merge -s我们的branch1 branch2 branch3 etc ,它回复合并策略失败。如果我提交压缩的合并和,然后多个父提交,则提交可以工作,但我有一个提交做了一些事情,后面跟着一个空提交,我不想这样做。如何将合并内容提交与合并父提交结合?

这听起来像你有一棵树有正确的内容,现在你想创建一个提交该内容和正确的父母。我不完全确定你将如何使用git porcelains来完成你想要的提交,但是因为你已经拥有了可以访问的管道,所以你可以直接使用它。



如果你已经正确地合并了所有的文件并且在你的索引中,你可以使用 git write-tree 来找出树的哈希值。 :

  $ git write-tree 
4d5fcadc293a348e88f777dc0920f11e7d71441c

然后你可以用正确的父母创建一个提交:
$ b $ pre $ code $ git commit-tree 4d5fcadc293a348e88f777dc0920f11e7d71441c -p branch1 -p branch2 ... -mDummy Message
85e2a8f2f71816d17887caaf39e46225e47165a9



更新你的分支以指向新的提交

  $ git reset --hard 85e2a8f2f71816d17887caaf39e46225e47165a9 

我通常使用虚拟消息创建提交,然后返回并使用 git commit --amend 稍后填写。

I just make 8 different suggestions off of the tip of master, and I want to make a commit that merges all of them together. I've done the merges by manually resolving merge conflicts one-by-one (and then squashed them together with git merge --squash), but now, when I try to make an octopus merge commit with git merge -s ours branch1 branch2 branch3 etc, it replies Merge with strategy ours failed. If I commit the squashed merges and then a multi-parent commit, the commit works, but I have a commit that does something, followed by an empty commit, and I don't want that. How do I combine the merge content commit with the merge parent commit?

解决方案

It sounds like you have a tree with the right content, and now you want to create a commit with that content and the right parents. I'm not entirely sure how you'd use git porcelains to make the commits you want, but as you've got the plumbing accessible to you, you may use that directly if you'd like.

If you've got all your files correctly merged and in your index, you can find out the hash of the tree using git write-tree:

$ git write-tree
4d5fcadc293a348e88f777dc0920f11e7d71441c

You can then create a commit with the right parents:

$ git commit-tree 4d5fcadc293a348e88f777dc0920f11e7d71441c -p branch1 -p branch2 ... -m "Dummy Message"
85e2a8f2f71816d17887caaf39e46225e47165a9

And update your branch to point at that new commit

$ git reset --hard 85e2a8f2f71816d17887caaf39e46225e47165a9

I usually create the commit with a dummy message then go back and use git commit --amend to fill it in later.

这篇关于我怎样才能制作一个复杂的章鱼合并?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆