6

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.

2 Answers 2

6

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} 
Sign up to request clarification or add additional context in comments.

3 Comments

Yes my files still look the same though... Is there something else to do?
maybe it's in previous commit... try to pickup the commit before it (find old commit using git log)
you can also check the difference btw the commits using command git diff commit-hash
0

To See Last Commit :

Way 1 : In Terminal type User$ gitk

Way 2 : In Terminal type User$ Git Gui -> Click 'Ammend Last change' radio button On Right Bottom Corner

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.