Wayne Werner Wayne Werner - 8 months ago 31
Git Question

Is there a way to get the number of additional commits in git without awk?

If I've got some tags in git I can use this:

git describe --tags | awk -F- '{ print $2 }'

To display the number of commits since my last tag. Is there a way to get this number just using git commands?


Git dark-voodoo:

git rev-list --count `git describe --abbrev=0 --tags` HEAD

or maybe slightly changed into (haven't Git, can't test, writing from memory)

git rev-list --count `git describe --abbrev=0 --tags`..HEAD


git log <RANGE> --pretty=oneline | wc -l

will work also, but a lot slower, than rev-list