Is there anyway to see how a file\'s size has changed through time in a git repository? I want to see how my main.js file (which is the combination of several files and mini
Here is a Bash function that will report the size over time in the following format.
LoC Date Commit ID Subject
942 2019-08-31 18:09:34 +0200 35fc67c122 Declare some XML namespaces in replacement of OGCPrefixMapper, which has been removed from Apache SIS. https://issues.apache.org/jira/browse/SIS-126
943 2019-08-09 16:52:29 +0200 e8438ab869 fix(GML): fix relative path resolving inside a jar
934 2019-08-05 15:37:46 +0200 1e0c0b03c4 fix(GML): fix all test cases
932 2019-07-30 15:54:53 +0200 fddea5db24 feat(GML): work on fallback for non-xsd Feature store
932 2019-07-23 16:40:23 +0200 8d9a6a7dd0 feat(GML): improve support for custom XML mappings
932 2019-06-26 15:18:43 +0200 43ea6e0bd7 feat(GML): add concurrency support for read/write operations
932 2019-06-21 09:27:41 +0200 07a9993b4b feat(GML): support group reference min/max occurs attributes
932 2019-06-21 09:27:41 +0200 352a9104ae feat(GML): fix resolving local files xsd paths
919 2018-06-08 15:41:26 +0200 01ac7538e7 Merge branch 'master' into sis-migration
919 2018-05-16 16:40:04 +0200 16fe7590c5 fix(JAXP): various fix for WFS 2.0.0
912 2018-04-11 10:09:22 +0200 bf3a38bdc4 chore(*): update JTS version 1.15.0
912 2017-11-09 20:15:23 +0100 bc14dc4be1 fix(Client): fix minor problems on WFS querying
901 2017-10-20 11:41:43 +0200 f686d7ff15 feat(Storage): add support for GML 2.1.2
882 2017-05-16 23:07:31 +0200 f20c34c1e2 refactor(Feature): renamed the Geotk flavor of org.apache.sis.feature package as org.geotoolkit.feature.
Here is the function:
git-log-size() {
git rev-list HEAD -- "$1" | while read cid; do
git cat-file blob "$cid:$1" | wc -l | tr -d '\n'
echo -n $'\t'
git log -1 "--pretty=%ci%x09%h%x09%s" $cid
done | column -t -s$'\t'
}
It is not particularly efficient, but does the job. It uses some utilities which are pretty common (wc, tr, column).
The size is reported as lines of code (LoC) since this is the common metric in software development, just change the "-l" option of wc if you prefer something else.
Here is how to call it:
git-log-size