marcin marcin - 1 year ago 94
Git Question

Average date of last line edit

git blame gives me date of last edit of every line in file.
It is possible to get average (or something similar) line edit date from whole file?

In other words I want have tool to evaluate how old is particular file. It can be helpful to decide which file potentially require some of refactor.

Answer Source
git blame --line-porcelain | grep "committer-time" | awk '{ sum += $2; n++ } END { if (n > 0) printf "%f\n", sum / n; }'

This works for me. Prints the average of commit timestamps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download