How can I merge many commits, but leave one out?

前端 未结 5 652
醉话见心
醉话见心 2020-12-07 19:37

Suppose I have this feature branch \"foo\". Now I want to merge it back into master, but I\'ve added some debugging code that I don\'t want in master.

The debug cod

5条回答
  •  忘掉有多难
    2020-12-07 20:39

    Use interactive rebase to remove the commits which you do not want.

    On a new branch "foo-merge" created from "foo":

    git rebase -i master
    

    Once you are in commit edit mode, remove the lines containing the debug commits, save, and quit from the editor.

    After rebasing, simply pull foo-merge into master:

    git checkout master
    git pull . foo-merge
    

提交回复
热议问题