开发者

tools to study source code using git history [closed]

开发者 https://www.devze.com 2023-02-13 04:31 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

Are there any recommended tools to study the source code of a git repository? My aim is to understand how has the code evolved with the incremental addition of new features to the code tha开发者_如何学运维t is in github.

I can click on "history" in github, but I was hoping to find some other git-related tool that would allow me to dig into the code in a bit more history-structured way.

Cheers


Just some idea's:

Firstly clone the repo you want to study, then use something like the following:

git log --pretty=%H

This will list the hash of each commit, then you can use the hash to get the diff between the the hash and the previous commit:

git diff HASH

By putting these into a script like this:

for HASH in `git log --pretty=%H`
do
    git diff ${HASH} > ${HASH}.diff
done

You can study what change was made at each point. Using various git log -1 --pretty=FORMATSTRING HASHOFCOMMIT" you can get also sorts of information out of a commit. You can also use commands like git blame filename to see the commit and author of each line of a file.

As per Jed's comments, don't forget gitk (works on both Unix and Windows).

0

精彩评论

暂无评论...
验证码 换一张
取 消