The treeish..treeish
notation works exactly to see the commits that are present in the second reference, but not in the first one. From the git log help:
A regular D..M computes the set of commits that are ancestors of M, but excludes the ones that are ancestors of D. This is useful to see what happened to the history leading to M since D, in the sense that "what does M have that did not exist in D".
Using this with either git log
or git show
you can output a list that contains a single line for each commit pressent in the D..M
difference:
git show -s --oneline branch..HEAD
or
git log --oneline branch..HEAD
Pair that with a word count and you can output exactly the number of commits you are looking for:
git log --oneline branch..HEAD | wc -l