Over a million developers have joined DZone.

Git Tip : Restore a deleted tag

· Java Zone

Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience, brought to you in partnership with JetBrains

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.

From http://www.baptiste-wicht.com/2011/06/git-tip-restore-a-deleted-tag/

Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}