在 Git 日志中跟踪文件状态变化

Tracking file status changes in a Git log

我正在编写一个程序,该程序使用 git log 输出来遍历存储库的历史记录,我想知道何时添加、删除、复制、移动或修改文件。 git log --numstat 是查看修改、复制和重命名的直接方法,但它不能提供区分添加或删除的文件与修改的好方法。 (添加文件时,numstat 只显示添加的行数与文件中的行数相同,删除一个文件时,显示删除的行数。)

阅读 git log -p 生成的补丁 headers 给了我这个信息,但我不关心实际的补丁。有什么方法可以只显示补丁 headers 或类似的东西吗?

git 日志 --name-status

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