2

I downloaded source code from github. Now i want to read the program though out the initial commits to the last one step by step. Is it possible to read ver.1 first then read ver.2 and so on.. using git ?

3 Answers 3

5

You can use git log to get the list of commits. If you actually want to read the complete code at each revision you can pass the hash to git checkout to checkout that revision and poke around; if you just want to see the changes you can use git show. I recommend using a client for the latter case though, like tig, which will let you step through each commit easily and see the changes:

Screenshot of tig

Sign up to request clarification or add additional context in comments.

2 Comments

Of course if you're one of those heretics who likes windows and clicking with the mouse, there's gitk.
@Jefromi Yeah, there's tons of clients; I like gitg personally
0

If it's actually source code and not, say, fiction, it might be more informative to just look at the latest version, and if you see anything weird or unusual, use git blame (or if you're a heretic like me, git gui blame) to see which commit that line of code was added/changed in, which in turn might give you a hint of why it was written that way. Or if you want to know what all was changed between version X and version Y, you could do git log X...Y

Comments

0

Maybe you can use the Git GUI.

Right click inside the repo, click 《Git GUI Here》, then click 《Repository》, then select 《Visualize All Branch History》.

RESET TO THE SPECIFIED VERSION

enter image description here

LOOK OVER NEARBY VERSION

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.