git 仅拉取特定标签

git pull a specific tag only

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

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

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

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

起点是我做的命令:

$ 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"

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

我找到的解决方案是:

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

如果远程更改想要与当前合并,将创建: $ git merger 1.0.12

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