git 只拉一个特定的标签

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42839127/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:40:27  来源:igfitidea点击:

git pull a specific tag only

gitgit-pull

提问by Victor Orletchi

I looking for command to make my life easiest.

我正在寻找让我的生活更轻松的命令。

The issue:have a project with sources. along of time i pushed more versions: v1.0.1 until v1.0.14 (latest) the version v1.0.12 is an patch and fixes special for myserver, but the myserver actually have installed v1.0.10 (I should update from v1.0.10 to v1.0.12)

问题:有一个有源的项目。随着时间的推移,我推送了更多版本:v1.0.1 直到 v1.0.14(最新)版本 v1.0.12 是一个补丁和专门针对 myserver 的修复程序,但 myserver 实际上已经安装了 v1.0.10(我应该从 v1.0.10 更新到v1.0.12)

the question:how to make an command to update the specific server to the looking version v1.0.12

问题:如何发出命令将特定服务器更新到版本 v1.0.12

i know command git pull but not understand how to do correct way also i want some options to prevent merge conflicts

我知道命令 git pull 但不明白如何做正确的方式我也想要一些选项来防止合并冲突

the start point is command that i made:

起点是我制作的命令:

$ git pull --rebase origin refs/tags/1.0.13:refs/tags/1.0.13
From http://192.168.0.12/gitlab/AF-NG/frontend-dist
* [new tag]         1.0.13     -> 1.0.13
* [new tag]         1.0.11     -> 1.0.11
* [new tag]         1.0.12     -> 1.0.12
* [new tag]         1.0.14     -> 1.0.14
First, rewinding head to replay your work on top of it...
Applying: 2.0.0
Using index info to reconstruct a base tree...
------
Falling back to patching base and 3-way merge...
Auto-merging styles/css/production.min.css
CONFLICT (add/add): Merge conflict in file.css
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort"

回答by Victor Orletchi

the solution that I find is:

我找到的解决方案是:

  1. $ git fetch -unf origin 1.0.12:refs/tags/1.0.12
  2. $ git checkout 1.0.12
  1. $ git fetch -unf origin 1.0.12:refs/tags/1.0.12
  2. $ git checkout 1.0.12

if remote changes wants to merge with current will make a: $ git merger 1.0.12

如果远程更改要与当前合并,则将执行以下操作: $ git merger 1.0.12

please tell me if my way is right

请告诉我我的方式是否正确

回答by Adam Nierzad

You need to use git checkoutto checkout the tag you want. This will make the working directory the same as it was when you created the tag.

您需要使用git checkout来结帐您想要的标签。这将使工作目录与创建标签时的目录相同。