How do I go back to previous commit?
I would like my files to look exactly like all my files did when I committed the below commit.
$ git log
commit 81cf7fa47adc0923aeabe323778e2783f2e832f5
Date: Thu Apr 2 21:32:27 2015 +1000
I looked around an so many people have different answers.
If you want to test the previous commit just do git checkout <test commit hash> ; then you can test that last working version of your project. If you want to revert the last commit just do git revert <unwanted commit hash> ; then you can push this new commit, which undid your previous commit.
You can always checkout to specific commit in git by following command
git checkout commit_hash
So in you case it will be
git checkout 81cf7fa47adc0923aeabe323778e2783f2e832f5
Or HEAD@{1} is the pointer to the one commit back so following will do the same
git checkout HEAD@{1}
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