We use SourceTree, which offers a “Reverse commit …” operation. But it didn’t quite work for me and at the end I did it in command line. Here’s what I ended up with:
- Checkout the branch you want to change - e.g., “develop” or “master”.
- Make sure you don’t have any local changes.
- Note the ID of the commit you want to “roll-back” to; in my case I had “1ac15a4”. This is the commit that will remain in the branch and become the head.
- Click on “Terminal” in SourceTree or simple open a terminal window and “cd” to the main local repository folder.
- Fire this command
git reset --hard 1ac15a4- obviously change the commit ID to whatever you noted down in step 3.
- I had a repository named as “origin” (within which we had “develop” and “master” branches. So the second and last command was:
git push origin -f.
That should do the trick and SourceTree should quickly update what it shows.