revert a commit
I’ve recently committed a cardinal sin of pulling a merge without checking. And then, I had to try to revert back to my original commit. However, I also encounter an error saying non-fast-forward
. Hence, you have to do the following steps for a correct revert
git revert {commit_id}
git push origin -f
After typing in your password, you should be reverted to the original state of the commit ID.
Note: To check your commit_id, on the right-hand side of Rstudio, you can see a clock next to the green up arrow. In the changes tab, you should see the column SHA
, which is the string of the commit id that you want to get.