How to move tag to the another commit at remote repo? Possible bug?

Valiantsin Luchko November 25, 2014

SourceTree Version 2.0.3 (2.0.3), OSX

Tag is created locally and pushed to remote.

 

$git ls-remote --tags
7232f4d05d4cb0a5d58da6e8b6f8ad5091b76510	refs/tags/MY_TAG

Then try to add the same tag with options Push to [remote] and Move existing tag I get error

I try to move MY_TAG from 7232f4d to c633bae.

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree tag -f MY_TAG c633baec0e902b757ca1e6c11e03d582c8eac43b 

Updated tag 'MY_TAG' (was 7232f4d)


git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v dropbox refs/tags/MY_TAG 

Pushing to some.git

To some.git

 ! [rejected]        MY_TAG -> MY_TAG (already exists)

error: failed to push some refs to 'some.git'

hint: Updates were rejected because the tag already exists in the remote.

Completed with errors, see above

Check tags:

$git show-ref --tags
c633baec0e902b757ca1e6c11e03d582c8eac43b refs/tags/MY_TAG
$git ls-remote --tags
7232f4d05d4cb0a5d58da6e8b6f8ad5091b76510	refs/tags/MY_TAG

 

4 answers

0 votes
Valiantsin Luchko November 25, 2014

Yes, it's obvious how to track deployed version at the server, tag or just hash, but is there a way to track it by git too. So one open SourceTree and see the commit deployed. Also we can write some script to download and show version.txt from every server, it's really simple, but the question is about git. Thank you, Seth, for the answer

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2014

Our company has a deployment script that takes a selected tag, exports the files at that tag, then writes the tag name to a web-accessible version.txt file. So our tags are version-numbers (not moveable), and you can find what code is deployed on a server by visiting the version.txt file on that server. Note that version.txt is NOT a file that is tracked by Git.

0 votes
Valiantsin Luchko November 25, 2014

Ok, let's say we use tags to mark deployed commit to particular server, how to mark it not using tags?

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2014

Be hesitant to move tags. Even if pushing the moved tag had worked as desired, doing so will cause problems for anyone else who has pulled that tag down to their machine. When moving a tag is necessary, make sure to inform other team members so they can delete their local copy of the tag.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events