- If the label is incorrectly typed, it can also be deleted:
$git tag -d v0.1 Deleted tag'v0.1' (was f15b0dd)
Copy the code
- Because created labels are only stored locally, they are not automatically pushed to remote locations. Therefore, mislabeled labels can be safely deleted locally.
- To push a label remotely, use the command
git push origin <tagname>
:
$git push Origin v1.0 Total 0 (delta 0) Reused zero (0) delta To github.com: michaelliao/learngit git * [new tag] v1.0 - > v1.0Copy the code
- Alternatively, push all local tags that have not been pushed remotely at once:
$ git push origin --tags Total 0 (delta 0), Reused zero (0) delta To github.com: michaelliao/learngit git * [new tag] v0.9 - > v0.9Copy the code
- If the tag has been pushed to a remote location, it is difficult to delete the remote tag from the local location:
$git tag -d v0.9 Deleted tag'v0.9' (was f52c633)
Copy the code
- Then, delete it from remote. Delete command as well
push
, but in the following format:
$git push origin: refs/tags/v0.9 To github.com: michaelliao/learngit git - [does] v0.9Copy the code
- To see if the tag is actually removed from the remote library, go to GitHub and check.
summary
- The command
git push origin <tagname>
You can push a local TAB; - The command
git push origin --tags
You can push all the local tags that have not been pushed; - The command
git tag -d <tagname>
You can delete a local tag; - The command
git push origin :refs/tags/<tagname>
You can delete a remote label.