Removing features from releases in Git Flow

In Git a merge commit does two things. Firstly it creates merge history, so Git knows what has been merged and what has not been merged. And secondly it joins the changes from two divergent lines of work together.

You can trick Git in both of these regards which is what it sounds like you need to do. There are two ways to create merge history without keeping the changes

git merge --strategy=ours 

and

git merge
git revert -m 1 MERGE_SHA

The former creates a merge commit (and merge history), but leaves out all the changes that would normally have been merged in. The later creates a merge commit (and merge history) and merges in the changes, but then immediately removes all the changes while preserving the first history.

In your instance, if you merged something in and then later change your mind, you would want to use the second form and revert the merge SHA. Now, to keep the changes from that merge from propagating forward to a different branch you would want to use the first form. Note that in order to use the first form effectively you may have to merge one SHA at a time instead (or use an additional feature branch for just this).

So imagine you have a branch trouble that contains 6 commits (1-6), and you need to merge trouble into master, but you don't want to merge the changes introduced in Commit 4. Instead of git merge trouble you would do

git merge 3 # merges 1/2/3
git merge -s ours 4 # creates merge history for 4, but does NOT merge any changes from 4 
git merge trouble # merges 5/6