git checkout tags/0.1.1
will checkout the FIRST commit tagged with that version, as far as I can tell. How can I programmatically checkout the most recent commit tagged with version 0.1.1
? I have made several commits with the same version number, and if I type git describe --tags
on master
, I get 0.1.1-3-g18562f7
. I can execute git checkout tags/0.1.1-3-g18562f7
to get there, but I don't know how to list tags in granular detail so as to be able to find such an automatically generated tag; git tag
, git show-ref --tags
, etc only show user-defined tags, e.g.
(base) elsphim-4176391:dude holmes5$ git tag
0.0.1
0.1.0
0.1.1
I don't know where to find a list of the automatically incremented build tags git
generates when you don't increment the version number.
CodePudding user response:
There are no automatically generated build tags that you would be able to list with a Git command.
When git describe --tags
on master
answers with 0.1.1-3-g18562f7
, then that means:
master
actually points to commit18562f7
,- the nearest tag before that commit is
0.1.1
, - and the commit graph at
master
has3
commits more than the graph at tag0.1.1
.
In your case that probably means you have this history:
--o--o--A--B--C <- branch master
^
|
tag: 0.1.1
You cannot express the names of A
, B
, C
with the tag name alone. You either must use master~2
for A
, master~
for B
and master
for C
, or you already know the commit IDs, then you do not need the tag name (nor the branch name) to address the commits.