英文:
How can I calculate the number of added/deleted/modified files between two commits in Git?
问题
git --no-pager diff
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论