0

I have 2 tags and I need to realize which one is ahead(I'm sure they are in same line). Is there a way how to make it done ? Edit: I mean automatically .. like to get commit1 < commit2 or other way around.

Biffen
  • 6,249
  • 6
  • 28
  • 36
sque
  • 1
  • 1
  • 1
    Possible duplicate of [git: Your branch is ahead by X commits](https://stackoverflow.com/questions/2432579/git-your-branch-is-ahead-by-x-commits) – Casual Coder Mar 07 '18 at 15:30
  • 1
    Possible duplicate of [Pretty git branch graphs](https://stackoverflow.com/questions/1057564/pretty-git-branch-graphs) – Liam Mar 07 '18 at 15:33

2 Answers2

0

Ok, I was able to get it by combination of

git show-ref --tags | grep -e tagName1 -e tagName2

git rev-list commitOfTagName1 --count

git rev-list commitOfTagName2 --count

and comp

sque
  • 1
  • 1
0

Rather simple — just count commits from one to the other in both directions. Example (from my real repo with real tags):

$ git rev-list v2.6.0..v2.5.0 | wc -l
0
$ git rev-list v2.5.0..v2.6.0 | wc -l
13

Now I see that tag v2.6.0 is ahead of v2.5.0 by 13 commits.

phd
  • 82,685
  • 13
  • 120
  • 165