拉取 git 存储库的特定标签
我使用的系统在高负载期间会自动启动新服务器,从 Github 下载应用程序代码,并部署 HTTP 服务器。但是,我不想从存储库的 master 分支中提取最新的提交,而是提取最新的标记提交。这可能吗?如果是这样,怎么办?
谢谢!
I am using a system that, during high load, automatically fires up a new server, downloads the application code from Github, and deploys an HTTP server. However, I don't want to pull the latest commit from the master branch of the repo, but rather the latest tagged commit. Is this possible? If so, how?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我所知,不;但是拥有一个始终包含您要部署的代码的“部署”分支怎么样?像往常一样在主服务器上工作,但只要代码处于稳定状态,就推动“部署”。
AFAIK, no; but how about having a 'deploy' branch which always contains the code you want to deploy? Work on the master as usual, but whenever the code is in a stable state push to 'deploy'.
我认为你想要做的就是只获取最新的标签。如果是这种情况,那么你可以使用 git-fetch 来完成:
I think what you want to do is fetch just the latest tags. If that is the case, then you can do it with git-fetch:
您可以使用 git describe 来获取标签的“最近”名称,然后在解析标记后检查该标签。
您可能希望使用 --tags 作为 git-describe 的参数,具体取决于您的需要。
You can use
git describe
to get the "nearest" name of a tag, then check out that tag after parsing the markup away.You may want to use --tags as an argument to git-describe, depending on your needs.