hatch
hatch

Reputation: 327

git describe --tags is not reporting the correct tag

When running git describe --tags on our repository it no longer reports the most recent tag on one of the branches even though it appears that the commits are in both branches.

Does anyone have any idea how this is occurred and how I may be able to resolve it so the tag is also available on the develop branch?

$ git tag
...
2.7.1
2.7.2
2.7.3
2.7.4

$ git checkout develop

$ git describe --tags --abbrev=0
2.7.2

$ git rev-list -n 1 2.7.4
d700ec90cd7a82be076c1b69b0815a3dab4597ac

$ git rev-list -n 1 2.7.2
79c161b96541da2d039e0cef649044f57387fa8d

$ git cat-file -t 2.7.2
commit

$ git cat-file -t 2.7.4
commit

$ git merge master
Already up-to-date.

$ git branch --contains d700ec90cd7a82be076c1b69b0815a3dab4597ac
* develop
  master

$ git describe --tags --abbrev=0
2.7.2

$ git log 2.7.4..HEAD
# shows the proper log even on develop (where the tag doesn't exist according to describe)

$ git checkout master

$ git describe --tags --abbrev=0
2.7.4

From the develop branch:

$ git describe --tags --abbrev=0 --debug
searching to describe HEAD
 lightweight      580 2.7.2
 lightweight      613 2.7.1
 lightweight      618 2.7.0
 lightweight      791 2.6.0
 lightweight     1134 2.5.2
 lightweight     1210 2.5.1
 lightweight     1345 2.5.0
 lightweight     1464 2.4.4
 lightweight     1597 2.7.4
 lightweight     1597 2.7.3
traversed 1600 commits
more than 10 tags found; listed 10 most recent
gave up search at f3a739ef25d49556538e990c110df3f465e29fa3
2.7.2

From the master branch:

$ git describe --tags --abbrev=0 --debug
2.7.4

From the develop branch (truncated):

$ git log --graph --decorate --oneline --all --simplify-by-decoration
* c813804fd (HEAD -> develop, origin/develop, origin/HEAD) Merge pull request #3070
* d700ec90c (tag: 2.7.4, origin/master, master) Bump version: 2.7.3 → 2.7.4
* ce8e6b8a9 (tag: 2.7.3) Bump version: 2.7.2 → 2.7.3
* 79c161b96 (tag: 2.7.2) Bump version: 2.7.1 → 2.7.2
* 17aa75b5a (tag: 2.7.1) Bump version: 2.7.0 → 2.7.1
* e4b0d4c7e (tag: 2.7.0) Bump version: 2.6.0 → 2.7.0

Upvotes: 2

Views: 2263

Answers (1)

jthill
jthill

Reputation: 60295

git log --graph --decorate --oneline --all --simplify-by-decoration will show you a skeletal overview of what's in your repo. Its output will be the best answer to your question.

git aliases for commands you wind up using often make life very handy, study up on how

git config alias.lgdo '!f() { git log --graph --decorate --oneline "${@---all}"; }; f'

works and you'll never go hungry again1 .


1Well, okay, maybe. But aliases and shell functions, and shell functions in aliases, and all the related ways to make things easier and faster so you can Git R Dun, are worth learning.

Upvotes: 1

Related Questions