简体   繁体   中英

Git:get changes released to master over time

as a personal project, I'd like to check different python libraries and projects (be it proprietary or open source) and analyze how the code was changed over time in different releases to gather some info about the technical debt (mainly through static code analysis). I'm doing this using gitpython library. However, I'm struggling to filter the merge commits to the master .

I filter the merge commits using git.log("--merges", "--first-parent", "master") from where I extract the commit hashes and filter these particular commits from all repository commits.

As the second part, I'd like to get all changed files in each merge commit. I'm able to access the blobs via git tree, but I don't know how to get only changed files.

Is there some efficient way how to accomplish this? Thanks!

... I'd like to get all changed files in each merge commit. ... but I don't know how to get only changed files.

Once you have your commit list as you described above, loop over them and run the following:

git diff

Use the git diff with the --name-only flag

在此处输入图片说明


git diff

--name-only
Show only names of changed files.

--name-status
Show only the names and status of changed files. See the description of the --diff-filter option on what the status letters mean.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM