Git Tip : Restore a deleted tag
Join the DZone community and get the full member experience.Join For Free
A little tip that can be very useful, how to restore a deleted Git tag.
If you juste deleted a tag by error, you can easily restore it following these steps. First, use
git fsck --unreachable | grep tag
then, you will see the unreachable tag. If you have several tags on the list, use
git show KEY
to found the good tag and finally, when you know which tag to restore, use
git update-ref refs/tags/NAME KEY
and the previously deleted tag with restore with NAME.
Thanks to Shawn Pearce for the tip.
Opinions expressed by DZone contributors are their own.