My coworker (superfamicom) showed me a fun git snippet that will allow you to see the total LOC (Lines of Code) in a given repo based on user:
git log --author="USERNAME" --pretty=tformat: --numstat | awk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' -
After a few different repos, I ended up finding that most of my total linesĀ were actually negative! I was unsure how to feel about this, but I quickly realized this is a potential upside. My rationale? Negative LOC = likelihood of refactoring. This theory also jives well with my current process of development:
- Figure out what the problem is to solve
- Write some code to solve it
- See if it works
- Test(?) and commit the working code
- Refactor the code early and often
- Repeat 4-5
Just an interesting thought.