So you made a "WIP" git commit that you didn't intend to push and then you made another commit after it.
Now you'd like to undo the WIP commit but it's no longer the most recent commit.
Here's how you can re-order the last two git commits to make the WIP commit the most recent again.
(This is only safe to do locally, before you push).
# Interactively rebase the last two commits. git rebase -i HEAD~2
An editor will pop-up with two "pick" statements. Swap the order of them. Save.