I fixed some code and pushed it with an incorrect commit message. When I tried to fix the commit message, by accident I reverted the commit. The situation is now:
All of this has already been pushed to the server.
I would like to get rid of the latest commit, change the commit message of the previous commit and push that back to the server.
I'm happy with solutions for Atlassian Source Tree but also command line is okay.
If it's the last commit, it's easy:
git commit --amend
This brings up the editor with the last commit message and lets you edit the message. (You can use -m if you want to wipe out the old message and use a new one.)
And then when you push, do this:
git push --force <repository> <branch>
Reference: Changing git commit message after push (given that no one pulled from remote)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With