简体   繁体   中英

How do I get the total number of authors contributed to a git repository by using the terminal?

I want to find out how many people contributed to a git repository. So basically I just want a number.

应该这样做:

git log --all --pretty="%an" | sort | uniq | wc -l

Git has this build in withe the shortlog command

git shortlog -s -n --all 

git shortlog

git-shortlog - Summarize git log output

-s, --summary
Suppress commit description and provide a commit count summary only.

-n, --numbered
Sort output according to the number of commits per author instead of author alphabetic order.

-all
Collect records form all branches

Note:
If you want to exclude merges add the --no-merges flag as well

在此处输入图片说明

To get a single count add the | sort | uniq | wc -l | sort | uniq | wc -l | sort | uniq | wc -l as @eftshift0 suggested

git shortlog -s -n --all --no-merges | sort | uniq | wc -l

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM