How do I go back to a previous Git Commit?

How do I go back to a previous commit?

I would like my files to look exactly the same as all my files when I made the transaction below.

$ git log
commit 81cf7fa47adc0923aeabe323778e2783f2e832f5
Date:   Thu Apr 2 21:32:27 2015 +1000

      

I looked around, many people had different answers.

+3


source to share


2 answers


You can always get a check for a specific commit in git by running the command

git checkout commit_hash

      

So in your case it would be



git checkout 81cf7fa47adc0923aeabe323778e2783f2e832f5

      

Or HEAD @ {1} is a pointer to one commit, so the next one will do the same

git checkout HEAD@{1}

      

+2


source


Viewing the last commit:

Path 1: In Terminal Type User $ gitk



Path 2: In Terminal Type User $ Git Gui -> Click the 'Ammend Last change' radio button at the bottom right

0


source







All Articles