Skip to content

Instantly share code, notes, and snippets.

@xhlwill
Last active April 28, 2017 07:52
Show Gist options
  • Save xhlwill/f73e6dd33a7f8c2fbf70 to your computer and use it in GitHub Desktop.
Save xhlwill/f73e6dd33a7f8c2fbf70 to your computer and use it in GitHub Desktop.
count total commits on current branch - 统计当前分支的提交数
git log | grep -e 'commit [a-zA-Z0-9]*' | wc -l
# 不准确,如果提交信息里有commit ...字样也会计算进去
# UPDATE:
git log --oneline | wc -l
# UPDATE 2:
# get the commit count for a revision (HEAD, master, a commit hash)
git rev-list --count <revision>
# get the commit count across all branches
git rev-list --all --count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment