Reputation: 2247
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 ?
Upvotes: 2
Views: 2641
Reputation: 175665
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:
Upvotes: 5
Reputation: 27
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
LOOK OVER NEARBY VERSION
Upvotes: 0
Reputation: 22136
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
Upvotes: 0