How do I prevent an automerge using Git?

前端 未结 5 1462
孤独总比滥情好
孤独总比滥情好 2020-11-28 20:47

I am trying to merge a local branch into the master branch without having Git to do an automerge. I would like to “hand pick” what I would like to be merged into master.

5条回答
  •  抹茶落季
    2020-11-28 21:48

    I think you want to cherry-pick individual changes:

    git checkout master
    git log --reverse --oneline topic ^master
    

    and then invoke git cherry-pick for each commit you want to have in the master branch.

    If the remaining changes in the topic branch should be preserved, you may also want to rebase this branch on top of the new master:

    git rebase master topic
    

提交回复
热议问题