How can I make a complex octopus merge?

前端 未结 2 1422
一向
一向 2021-02-09 22:11

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 con

2条回答
  •  心在旅途
    2021-02-09 22:41

    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.

提交回复
热议问题