Today i am going to show you how you can go back to a previous commit.
lets say for example you are working on a commit, but then you decide to go back to the preious commit or to the last commit.
you go back and after working on it, you forgot which commit was the last one?
the question now is, how do you go back. the answer is easy, you just need to know what is the commit id. to find the commit id, all you have to do is look at all the commits in your branch, if you did not change branches, then your still in the 'master' branch. the command you will need is reflog
to view all the commits in the branch, just send this command:
$ git reflog
you will see a list of all the commits in the master branch, this list will give you the commit id
once you know what the commit id is, just switch to that commit id
$ git checkout commitId
hope that hellps