joeyk16
joeyk16

Reputation: 1415

How do I go back to previous Git Commit?

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.

Upvotes: 6

Views: 4088

Answers (2)

Hardik
Hardik

Reputation: 3895

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}

Upvotes: 6

vijay
vijay

Reputation: 10997

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

Upvotes: 0

Related Questions