Last Updated: February 25, 2016
·
595
· zabolotnov87

Another way to count total lines of code

This command will help you to count total lines of git repo:

git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904..HEAD --shortstat 

Example Output:

210 files changed, 4732 insertions(+)

where insertions represents the total lines of git repo.

Note:

  • you should have git version > 1.8.5
  • 4b825dc642cb6eb9a060e54bf8d69288fbee4904 - SHA1 of empty tree. You can always derive it with:
git hash-object -t tree /dev/null