git上拉取tag,识别最新tag在此版本上新增tag

通过shell 脚本自动获取最新tag,并输入最新版本后,推到git上

# 拉取分支上现有的tags

git fetch --tags

echo -e "所有tag列表"
git tag -l -n


echo -e "${tagList}"
#获取最新版本tag
LatestTag=$(git describe --tags `git rev-list --tags --max-count=1`)

echo -e "最新版本tag......"
echo -e "$LatestTag"

echo -e "请输入要新增的版本号...... 如 v1.0.1"
#输入tag名称
read tagName

git tag ${tagName}
#推到分支上
git push origin ${tagName}
posted @ 2019-05-16 13:41  zhidanwang  阅读(7650)  评论(0编辑  收藏  举报