If you're removing a commit and don't want to keep its changes @ferit has a good solution.
If you want to add that commit to the current branch, but doesn't make sense to be part of the current pr, you can do the following instead:
git rebase -i HEAD~n
git reset HEAD^ --soft
to uncommit the changes and get them back in a staged state.git push --force
to update the remote branch without your removed commit.Now you'll have removed the commit from your remote, but will still have the changes locally.