Reference : https://www.youtube.com/watch?v=3dk3s4LK-Wg

I came across this issue while making react able for my Jekyll site, and then I realized that I should not do it that way.. But I made several commits, so I wanted to just remove all the commits.

Simple as this can be is, after typing git log, we can jsut go to the commit hash, and do



git reset –hard HASH123

and then it will change. If you had pushed to the github before, git won’t let you to push it, so you should also force it…

git push –force

but.. there are simpler, (actually this is also simple enough.. ) solutions too.

If you didn’t add or commit your changes, you can simply do..

git checkout – filename
or..
git checkout – .

if you have more than one file.

There is also this git revert thing that can save you the history in log

git revert HASH123

and you will be allowed to write a message and the revert will be commited as a commit.

You can also not commit it by using the “-n “ option in git revert. The working tree will be reverted but it would not be committed.