Counter counts tag

I am trying to count the number of commits since the tag was created.

I tried using git rev-list , but it seems to return the same results no matter what I try. This is what I tried:

 $ git rev-list 1.7Start^..HEAD | wc -l 13902 $ git rev-list HEAD | wc -l 13902 

An attempt to calculate how many commits have been made since the 1.7Start tag was created. I'm on master now, so using HEAD , but using git rev-list master | wc -l git rev-list master | wc -l , gives me the same thing.

13,000+ have not been recorded since 1.7

Should git rev-list master show me every commit in master and therefore give a larger number than 1.7Start^..master , which should just give me the difference?

+7
source share
3 answers

The results you get suggest that there is no common history between 1.7Start^ and HEAD , so 1.7Start and HEAD must have different root commits. (The syntax a..b when passing to git rev-list simply means "every commit in b that is not in a .)

In the comments above, the questionnaire indicated that this happened because the repository was migrated from Subversion, and master completely different from the imported branch that 1.7Start points 1.7Start .

+4
source

Git has git rev-list --count, which makes it faster than wc-l.

There is also git rev-list --use-bitmap-index --count in later versions of git, which is a --count optimization.

rev-list requires a commit, so the example is to find all the commits in your repo for your current branch.

 git rev-list --count HEAD 
+3
source

If you need only the last tag , as it usually happens, git describe will tell you what the last tag is and how many commits have been made in the current branch, since it is . For example, in the example below, the last tag was 0.1.9, and 67 commits were made in the current branch.

 $ git describe --tags 0.1.9-67-gff9fd30 

For verification, you can see the full list of commits using the command below. If you output your output to wc -l , the same counter should be returned. Please note that !! is the previous team in Bash.

 git log --oneline $(git describe --tags --abbrev=0).. $ !! | wc -l 67 
0
source

All Articles