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
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