Reputation: 1682
After making some changes to the head of a branch, we need to move the release tag. When I tried to do so, I ran into a confusing git error message and ask for someone knowledgeable to explain it. I can find many web pages with similar messages, but none of the explanations I looked at seemed to apply. Please avoid admonishing me about the sane vs insane methods discussed in the man page as there are outside reasons why this method was chosen, which are not useful to this discussion.
What I did:
In the local and remote repository, I ran "git tag -d Release_7_3_16" to remove the existing tag. A git push/pull in my local repository said no changes. 'git tag' in either the local or origin directory showed the tag did not exist.
Then in my local repository I ran "git -f -a Release_7_3_16" (since I was already sitting on the correct branch) to (re-)create the tag at the proper change.
I attempted to push the tag to the remote with "git push origin :refs/tags/Release_7_3_16", but it gave this error:
remote: warning: Deleting a non-existent ref.
To /db/sds14/user2/cg_sandbox/depot/cg_sandbox.git/
- [deleted] refs/tags/Release_c60_7_3_16
What does this actually mean, as I am not deleting anything at this point?!?
Upvotes: 3
Views: 3204
Reputation: 488453
I attempted to push the tag to the remote with "git push origin :refs/tag/Release_7_3_16"
That syntax—specifically the :name
part—means "please delete" on the remote.
The warning message from the remote means "I didn't have this name in the first place". That is, you asked the remote (origin
, in this case) to delete refs/tag/Release_7_3_16
, which it thought looked like a reasonable request, so it went to find refs/tag/Release_7_3_16
and discovered it does not exist.
This is not very surprising as tags live in refs/tags/
(plural "tags"), not refs/tag/
(singular "tag").
As for moving the tag on the remote, you may want to read over this answer.
Upvotes: 4