To get git tags with the SHA1 hash of the Tag object, you can run:
git show-ref --tags
The output will then look something like:
0e76920bea4381cfc676825f3143fdd5fcf8c21f refs/tags/1.0.0
5ce9639ead3a54bd1cc062963804e5bcfcfe1e83 refs/tags/1.1.0
591eceaf92f99f69ea402c4ca639605e60963ee6 refs/tags/1.2.0
40414f41d0fb89f7a0d2f17736a906943c05acc9 refs/tags/1.3.0
Each line is the SHA1 hash of the tag, followed by the tag name prefixed with refs/tags/
.
If you want the SHA1 hash of the commit, instead of the tag object, you can run:
git show-ref --tags -d
This will produce output like:
0e76920bea4381cfc676825f3143fdd5fcf8c21f refs/tags/1.0.0
3e233dd8080617685992dc6346f739a6f6396aae refs/tags/1.0.0^{}
5ce9639ead3a54bd1cc062963804e5bcfcfe1e83 refs/tags/1.1.0
09173980152a7ed63d455829553448ece76c6fdc refs/tags/1.1.0^{}
591eceaf92f99f69ea402c4ca639605e60963ee6 refs/tags/1.2.0
56d803caaa8a93a040b7be0b8a36abdc4ce8c509 refs/tags/1.2.0^{}
40414f41d0fb89f7a0d2f17736a906943c05acc9 refs/tags/1.3.0
1bdf628a70fda7a0d840c52f3abce54b1c6b0130 refs/tags/1.3.0^{}
The lines ending with ^{}
start with the SHA1 hash of the actual commit that the tag points to.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…