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

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

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.

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

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.

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

946 views 3 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you