I am trying to count the number of commits since a tag was made.
I have tried using git rev-list
but it seems to return the same results no matter what I try. This is what I have tried:
$ git rev-list 1.7Start^..HEAD | wc -l
13902
$ git rev-list HEAD | wc -l
13902
Trying to count how many commits since the 1.7Start tag was created. I'm currently on master
hence using HEAD
but using git rev-list master | wc -l
gives me the same.
There hasn't been 13000+ commits since 1.7
Should git rev-list master
show me every commit in master and hence yield a larger number than 1.7Start^..master
which should just give me the difference?
If the working tree has local modification "-dirty" is appended to it. If a repository is corrupt and Git cannot determine if there is local modification, Git will error out, unless '--broken' is given, which appends the suffix "-broken" instead. --all.
Check the documentation for git describe . It finds the nearest tag to a given commit (that is a tag which points to an ancestor of the commit) and describes that commit in terms of the tag. In newer versions, git describe --tags --abbrev=0 REV will be useful when you don't want the junk on the tag.
Find Latest Git Tag Available In order to find the latest Git tag available on your repository, you have to use the “git describe” command with the “–tags” option. This way, you will be presented with the tag that is associated with the latest commit of your current checked out branch.
The results that you're getting suggest that there is no history in common between 1.7Start^
and HEAD
, so 1.7Start
and HEAD
must have different root commits. (The syntax a..b
when passed to git rev-list
just means "every commit in b
which isn't in a
.)
In the comments above, the questioner indicated that this arose because the repository was migrated from Subversion, and master
is entirely distinct from the imported branch that 1.7Start
points to.
Git has git rev-list --count which does this faster then wc-l.
There is also the git rev-list --use-bitmap-index --count in later versions of git, which is an optimization of --count.
rev-list needs a commit, so an example, to find all the commits in your repo for your current branch.
git rev-list --count HEAD
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With