你可以使用Git来计算两个提交之间添加/删除/修改的文件数量。

huangapple go评论49阅读模式
英文:

How can I calculate the number of added/deleted/modified files between two commits in Git?

问题

git --no-pager diff .. --stat 只提供了更改的文件信息,而没有具体说明添加或删除了多少文件。

英文:

Is there a way to calculate the number of files that were added/deleted/changed (each one separately) between two commits in git?

git --no-pager diff <commit-ish1>..<commit-ish2> --stat

only gives files changed, not specifying how many were added or deleted.

答案1

得分: 4

尝试类似以下方式:

git diff --name-status master | cut -c 1 | sort | uniq -c
     32 A
     16 D
    611 M
     60 R

请参阅文档以了解 --diff-filter 的代码含义:https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203。

英文:

Try something like;

git diff --name-status master | cut -c 1 | sort | uniq -c
     32 A
     16 D
    611 M
     60 R

See the docs for --diff-filter to see what the codes mean; https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203.

huangapple
  • 本文由 发表于 2023年2月14日 19:39:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75447295.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定