0

I do like to write code, but what I like even more is to remove code! Following the mantra "code that does not exist cannot have bugs", if we can accomplish the same result with less code, we will make our lives easier in regard to future maintenance (and I've spent a lot of hours in maintenance).

In my new job, I am fortunate enough to be able to do quite a bit of refactoring, and I think that during the first several weeks of my employment, I actually removed more code than I wrote. That got me thinking: I'd like to keep tally.

How can I keep a running balance of lines added and removed across my check-ins in multiple (PHP and Java) projects?

I know about the source code line counter "Ohcount", but that counts the total codebase and not just my contributions to it. I'm sure it's possible to write a script and stick it into cron, but I'm sorry to say I'm not very good at scripting.

We use both GIT and SVN on Ubuntu 14.04.

2

SVN Blame can output xml, so you can script a blame and aggregate the changes you made in a script. If you combine with the -x flag then it'll only report meaningful changes.

I'm sure git blame is much the same, except it has a handy option to show stats.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.