Number of commits on branch in git

前端 未结 4 960
甜味超标
甜味超标 2020-12-08 20:41

I\'m writing a small script and want to know how many commits I made on a current branch since it was created.

In this example I\'d have 2 commits made on chil

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 21:28

    Update: git rev-list now has --count:

    git rev-list --count master..
    

    With older git versions:

    git rev-list master.. |wc -l
    

    rev-list lists revisions, and master.. refers to commits since current HEAD diverged from master.

提交回复
热议问题