Git - list all authors of a folder of files?

后端 未结 3 1192
梦毁少年i
梦毁少年i 2021-02-03 23:11

How can I list the author names of a particular folder that\'s versioned by git?

I see that I can git blame a file and list the author of each line, but I c

3条回答
  •  广开言路
    2021-02-03 23:40

    If you want only the list of authors of a repository:

    git ls-files | xargs -n1 git blame --line-porcelain | sed -n 's/^author //p' | sort -d | uniq

    If you want to do it for a file order by the number of lines of code contributions it is simple:

    git blame --line-porcelain "_MY_FILE_" | sed -n 's/author //p' | sort | uniq -c | sort -rn

    If you want to do it for the whole repository also ordered by code contributions:

    git ls-files | xargs -n1 git blame --line-porcelain | sed -n 's/^author //p' | sort -f | uniq -ic | sort -nr

提交回复
热议问题