Number of commits on branch in git

前端 未结 4 949
甜味超标
甜味超标 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:35

    Assuming you branched from master, master..yourbranch gives you the range of commits that are in yourbranch but not in master.

    Then you just have to list them one line each, and count the number of lines:

    git log master..yourbranch --pretty=oneline | wc -l
    

提交回复
热议问题