1

For example, count the SLOC of git with the given date(2 years ago or else).

And I have another question: How to figure out the top 10 program files and top 5 components that are modified the most (have the largest total number of changed lines of code or have the largest number of modifications)in git library with given date?

CVIn
  • 13
  • 3

1 Answers1

1

You can adapt this ruby script, which calls git diff --stat in order to get those statistics.

For python, you have "git-loc"

2010-05-13 14:38:21       42   +44    -2     initial
2010-05-13 14:40:14       44    +3    -1     hashbang added
2010-05-13 14:40:14       49    +8    -3     show last commit too

Run it as `git-loc --svg' to output svg graph on stdout.

See git rev-parse SPECIFYING REVISIONS to check how to use dates:

<refname>@{<date>}, e.g. master@{yesterday}, HEAD@{5 minutes ago}

A ref followed by the suffix @ with a date specification enclosed in a brace pair (e.g. {yesterday}, {1 month 2 weeks 3 days 1 hour 1 second ago} or {1979-02-26 18:30:00}) specifies the value of the ref at a prior point in time.

You can combine those git diff or git log commands with "Finding most changed files in git":

git log --pretty=format: --name-only | sort | uniq -c | sort -rg | head -10
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you very much! It is really worked for me. But is there no direct way to find the top 10 files of largest codes changed? I can program it with C or python, what options of 'git log' suit for me? Thank you! – CVIn Nov 18 '13 at 10:45
  • @CVIn the last part of my answer is suppose to sort the files with the most changes: the 10 first should be the ones you are looking for. – VonC Nov 18 '13 at 11:26