In a git post-commit hook how do I get a list of the files that were changed?

后端 未结 2 1691
情深已故
情深已故 2021-01-02 05:02

Trying to figure out how long time was spent in a commit in a Git post-commit hook.

I\'ve got a post-commit git hook that submits information over an API about the c

2条回答
  •  别那么骄傲
    2021-01-02 05:36

    Been doing some research and found that git log --name-only -n1 is the best approach. It's not difficult to get the min. and max. timestamps out of the files by doing a bit of string matching and using the Python os.stat module.

    As a general solution it still isn't great because the modification times on the files doesn't really reflect the reality of the time spent actually.

提交回复
热议问题