Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git tag delete and re-add

On git hub I re-added the tag by doing:

git tag -d 12.15 git push origin :refs/tags/12.15 git tag -a 12.15 -m '12.15' git push --tags 

The tag is still referring to the old tag on github, but locally it is done right.

UPDATE: It seems github is listing the last commit wrong, but downloading it correctly.

like image 982
Chris Muench Avatar asked Oct 30 '11 19:10

Chris Muench


People also ask

Can you reuse a git tag?

Git tags can't be reused. A tag can be removed and reassigned.

Can I update a tag in git?

Similar to this, sometimes, we are required to update the tags in Git. Updating a tag will take your tag to another commit. For example, we can update the tag v1. 1 to another commit depicting that the stable Version1.

What happens when we delete a git tag?

The tag and commit would still exist if the branch is deleted. A branch is simply a way to track a collection of commits.


1 Answers

The reference is https://stackoverflow.com/a/5480292/1317035

You just need to push an 'empty' reference to the remote tag name:

git push origin :tagname 

Or, more expressively, use the --delete option:

git push --delete origin tagname 

Pushing a branch, tag, or other ref to a remote repository involves specifying "push where, what source, what destination?"

git push where-to-push source-ref:destination-ref 

A real world example where you push your master branch to the origin's master branch is:

git push origin refs/heads/master:refs/heads/master 

Which because of default paths, can be shortened to:

git push origin master:master 

Tags work the same way:

git push refs/tags/release-1.0:refs/tags/release-1.0 

By omitting the source ref (the part before the colon), you push 'nothing' to the destination, deleting the ref on the remote end.

like image 163
nickleefly Avatar answered Sep 21 '22 12:09

nickleefly