Three minutes to teach you to learn git (16)-Stats

Source: Internet
Author: User

Sometimes want to count the warehouse, such as the amount of code, contributors and the like.


1 count the number of commits of a person

git log--author= "$ (git config--get user.name)"--oneline | Wc-l


2 counting the amount of someone's code

git log--author= "$ (git config--get user.name)"--pretty=tformat:--numstat | awk ' {adds + = $ subs + = $ + + $ + + $ + $ + $ + + + $-END {printf "added lines:%s removed lines:%s All lines:%s\n", Adds,subs,a LL} '


3 Submission Ranking Top 10

The%an representative displays only the author name of the commit. You can also use%ae, use author email to prevent the occurrence of duplicate names. Then sort by name or email, then count after Uniq, then sort by number in the first column and last 10 records.


git log--pretty=%an | Sort | uniq-c | Sort-k1-n-R | Head-n 10


4 statistics of how many code contributors

Sort-u equals Sort | Uniq


git log--pretty=%an | Sort-u | Wc-l


Original: http://blog.csdn.net/hongchangfirst/article/details/46606707

Author: Hongchangfirst

Hongchangfirst's homepage: http://blog.csdn.net/hongchangfirst



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Three minutes to teach you to learn git (16)-Stats

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.