Jos*_*žek 87
# Get new tags from remote
git fetch --tags
# Get latest tag name
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
# Checkout latest tag
git checkout $latestTag
Run Code Online (Sandbox Code Playgroud)
exu*_*sum 21
git describe --tags 应该给你信息.
bash/shell脚本:
#!/bin/bash
...
latesttag=$(git describe --tags)
echo checking out ${latesttag}
git checkout ${latesttag}
Run Code Online (Sandbox Code Playgroud)
小智 11
在某些存储库中,由于git以奇怪的方式对标记进行排序git describe --tags,因此不提供任何信息和简单git tag | tail -1可以使您获得错误的标记.
对我来说,最好的命令是尾部的变化
VERSION = $(git tag | sort -V | tail -1)