Edison
Edison

Reputation: 4291

Going Back and Forth in commit log

I have initialized a git repository and added a number of commits to it.Now I want to do the following.

1.How to go back in point of time that is if There are commits A,B,C,,,Y and currently I am in commit Y how can I change my project when it was before commit E? 2.By the same token if I have gone back in point of time will I be able to go from commit E to commit X which lies in future?

I know above may sound a bit stupid I apologize for my stupidity.

Upvotes: 0

Views: 138

Answers (1)

amalloy
amalloy

Reputation: 92077

This is what git checkout does. You can just git checkout E, where E is the SHA identifying the commit you want to time-travel to, and your working tree will change to reflect what it was at that time. You can then use the same mechanism to go back to Y: git checkout Y.

Upvotes: 1

Related Questions