Git的结帐最新标签 [英] Git Checkout Latest Tag

查看:135
本文介绍了Git的结帐最新标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一个shell脚本,我期待结帐最新版本的回购。具体来说,我想除了把此过程分为多个步骤。

I'm writing a shell script and I'm looking to checkout the latest version of repo. Specifically I want to break this process apart into multiple steps.


  1. 我要最新的标签保存库到一个变量

  2. 打印出检查出的版本:XX

  3. Google Checkout的最新标签

我见过类似问题,但我不明白如何保存标签的名称到一个变量(可能是因为我用shell脚本一个小白)。

I've seen similar questions but I don't see how to save the name of the tag into a variable (probably because I'm a noob with shell scripts).

推荐答案

git的描述--tags 应该给你的信息。

的bash / shell脚本:结果

bash/ shell script:

#!/bin/bash
...
latesttag=$(git describe --tags)
echo checking out ${latesttag}
git checkout ${latesttag}

这篇关于Git的结帐最新标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆