0

I want to get all authors that contributed to a file (working). Additionally I want the number of lines from each author of a file (working). And in the end I also want each line number that was contributed by each author. The format should not be 1, 2, 3, 4, 5, 11, 12, 13, 14 but instead be something like 1-5, 11-14. Is that doable in an "easy" way on the command line? I can't do anything by hand as we have thousands of files with around 2 million lines of code.

files=$(git ls-tree -r HEAD | cut -c54-)
for file in $files
do
        echo $file
        git blame $file --line-porcelain | grep  "^author " | sort | uniq -c | sort -r
done

is doing what i want besides the line numbers.

Elim Garak
  • 33
  • 5
  • 1
    okay, so, what, you want someone to show you how to postprocess `git blame | cat -n`? – jthill Nov 15 '22 at 16:35
  • No, an easy way. So something that already can do it without doing a lot of programming. Maybe an option in one of the git commands. But maybe I understood in the wrong way as I can't see a benefit in using cat -n. Numbered lines I already get with git blame. If I do any post processing I probably will use this output directly. – Elim Garak Nov 16 '22 at 13:14

0 Answers0