say i have a git repo, with such commit history: A-B-C-D-E
Now, suddenly i realise, that commits B and C are completely flawed and unnecessary.
Also, say i have the complete freedom to rewrite project history (perhaps i’m working on the project alone).
I have another branch pointing to the commits B and C, so losing them is not a problem. If i ever actually need those changes, i can checkout that branch and see them.
But for the master branch, i would like to force the history to be A-D’-E’, where D and E not only have a modified parents list, but also do not contain the changes that were introduced by commits B and C.
Is this possible to do? And if so, how?
git rebase -i HEAD~5Then, remove the unwanted commits from the list of commits