People wouldn’t like to see a wrong commit and a revert commit to undo changes of the wrong commit. This pollutes commit history.
Here is a simple way for removing the wrong commit instead of undoing changes with a revert commit.
-
git checkout my-pull-request-branch
-
git rebase -i HEAD~n
// wheren
is the number of last commits you want to include in interactive
rebase. - Replace
pick
withdrop
for commits you want to discard. - Save and exit.
git push --force