Getting committed lines of code count, through git


git diff --stat 4b825dc642cb6eb9a060e54bf8d69288fbee4904


Git has a “secret” hardcoded SHA1 for an empty tree, referenced in the source code as EMPTY_TREE_SHA1 which is technically the /dev/null tree.
You can find the hash by doing git hash-object -t tree /dev/null
So with git diff --state 4b825dc642cb6eb9a060e54bf8d69288fbee4904 you get the difference between your current tree and an empty tree, which will return the lines of code committed

Note: That package.json and package-lock.json can become pretty big 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *