I have a project with two branches called master and feature/x. On feature/x I'm working on new features that will be merged on master.
For mistake on feature/x a rebase action based on master was done and pushed. Besides other commits were done and pushed on feature/x.
So I have two branches that contain "same commits" marked by different hash.
A -- B -- C -- D [master]
\
E -- F -- G -- H -- I [feature/x]
where C and D on master are respectively the same commits (rebased) of F and G on feature/x.
I would like to remove F and G from feature/x maintaining H and I. How can I do it?
I'm thinking to revert commit
git revert F G
from feature/x but those useless (duplicate) commits will remain in the history. I would know if there are better way to do it?