0

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?](https://stackoverflow.com/questions/2528111/how-can-i-calculate-the-number-of-lines-changed-between-two-commits-in-git) – phd Nov 16 '18 at 11:53
  • https://stackoverflow.com/search?q=%5Bgit%5D+count+changed+lines – phd Nov 16 '18 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. –  Nov 16 '18 at 12:47

1 Answers1

1

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