Santhosh
Santhosh

Reputation: 5016

Remove a feature branch merge from master but keep all other feature branch merges

I have merged a feature-branch(F1) into master. And then merged another feature-branch(F2), and then F3. Now, I have noticed that F1 merge has logical bugs and I don't want this feature-branch to be part of master. But I should have F2 and F3 in master which are merged later F1.

I have tried this but it is removing F2 and F3 as well.

git revert <F1 merge-commit-SHA>

Could anyone help me out? Thanks in advance.

Upvotes: 0

Views: 486

Answers (1)

Alex028502
Alex028502

Reputation: 3814

try adding -m1 to your revert command; this will revert the changes with respect to the "first parent" which is the main line, and should hopefully undo exactly what was changed in master. Make sure you are putting in the merge commit itself

git revert [merge-commit-hash] -m1

I think that will work. Let me know if I am wrong

(if you didn't get an error when you didn't put an -m param before, it makes me wonder if you were not putting in the merge commit hash)

Upvotes: 1

Related Questions