How can I calculate the number of lines added and modified from First commit(initial commit) to Last commit in git?
- Possible duplicate of How can I calculate the number of lines changed between two commits in git?phd– phd2018-11-16 11:53:34 +00:00Commented Nov 16, 2018 at 11:53
- stackoverflow.com/search?q=%5Bgit%5D+count+changed+linesphd– phd2018-11-16 11:53:40 +00:00Commented Nov 16, 2018 at 11:53
- @php - the question you referred is about 2 commit, and this question specifically is about first commit and last commit. Hence this is not duplicate.user7154703– user71547032018-11-16 12:47:44 +00:00Commented Nov 16, 2018 at 12:47
Add a comment |
1 Answer
Either of below commands can be used, stats will be same
1) display stats with count of changed file, insertion count and deletion count
git diff $(git log --pretty=format:"%h" | tail -1) --shortstat
2) display only count of changed and newly added line count, but does not consider deleted line count
git diff $(git log --pretty=format:"%h" | tail -1) | grep '^+' | grep -v +++ | wc -l