Victor Orletchi
Victor Orletchi

Reputation: 497

git pull a specific tag only

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)

the question: how to make an command to update the specific server to the looking version 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

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"

Upvotes: 12

Views: 30975

Answers (2)

Victor Orletchi
Victor Orletchi

Reputation: 497

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

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

please tell me if my way is right

Upvotes: 11

Adam Nierzad
Adam Nierzad

Reputation: 942

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

Upvotes: 6

Related Questions