3

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?!?

simpleuser
  • 1,617
  • 25
  • 36

1 Answers1

4

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.

Community
  • 1
  • 1
torek
  • 448,244
  • 59
  • 642
  • 775
  • I edited the question, since when I ran the original command I did correctly use tags according to my history. i did make a mistake when I reran the command to get the output for the question, but that was really a dumb error when I was entering this, so I fixed the question. Your explanation about the leading colon meaning delete explains the problem; I thought the colon meant something else, and will re-read the documentation on push. – simpleuser Apr 11 '14 at 06:28