Reputation: 41
I have cloned a lecture project from Github. The project is a finalized one and it contains multiple commit history eg: Lecture 1, Lecture2.
Using the software TortoiseGit, I am able to review the log of Git commits. What I am trying to do is that I need to review code of the same project from lecture 1 to lecture 7.
However, if I try to use reset hard/ check out to go back to specific commit, nothing seems to happen. The folders and files do not seem to change.
I read from the Net that using cleanup command could make it work. So I cleaned up. It indeed went back to the old version. However, the commit history after this commit is missing. Then I cannot proceed.
Thank you in advance
Basic Procedures:
Init: at Lecture 7
Operation1 : Go back to Lecture 1
Operation 2: Go to Lecture 2
Operation 3: ....
Operation 7: go back to lecture 7
Upvotes: 0
Views: 280
Reputation: 521239
You may checkout an earlier commit directly via:
# from your_branch
git checkout <SHA-1 has of earlier commit>
This will put Git into the detached HEAD state, where the HEAD points some earlier commit in the branch, but is not actually on a particular branch. You may poke around and review the code, and when you are finished, return to your original branch via:
git checkout your_branch
Upvotes: 1