I want to list every contributors for each file in the repository.
Here is currently what I do:
find . | xargs -L 1 git blame -f | cut -d' ' -f 2-4 | sort | uniq
This is very slow. Is there a better solution ?
I want to list every contributors for each file in the repository.
Here is currently what I do:
find . | xargs -L 1 git blame -f | cut -d' ' -f 2-4 | sort | uniq
This is very slow. Is there a better solution ?
git log --pretty=format:"%cn" <filename> | sort | uniq -c
You can also do more with git log, Ex: committers to each file after certain date (Ex: after 2018-10-1):
git log --after="2018-10-1" --pretty=format:"%cn" <filename> | sort | uniq -c
Don't use --stat if you don't need the stats, why ask it to rerun all the diffs, then scrape all the results off? Just use --name-only.
git log --all --pretty=%x09%cN --name-only | awk -F$'\t' '
NF==2 { name=$2 }
NF==1 { contribs[ $0 ][ name ] = 1 }
END {
n = asorti(contribs,sorted)
for ( i=0 ; ++i < n ; ) {
file = sorted[i]
print file
for ( name in contribs[file] ) print "\t"name
}
}
'