How do I prevent an automerge using Git?

前端 未结 5 1464
孤独总比滥情好
孤独总比滥情好 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:39

    You are trying to bypass Git from getting involved in the merge process and to hand-pick each line of each modified file to be merged. This not the same as git cherry-pick. Neither will git merge --no-commit, etc. help. You will need to do:

    $ git checkout master
    $ git difftool -t kdiff3 local-branch HEAD
    

    In the KDiff3 window, the left hand side (A) is your local-branch and the right hand side (B) is your current branch (master).

    Select Merge | Merge Current File from the menu (or press the colorful diamond shaped icon with the same title).

    You will then be shown a diff and conflicts (if any) for each file. And you will have the ability to pick left or right side (A or B), or both, and/or manually tweak the merged file.

    On another note, something is telling me you have some bigger issues with your workflow.

提交回复
热议问题