{"thread":{"id":"25200","subject":"Restore annotated tag?","startedAt":"2010-09-22T18:14:28Z","lastAt":"2010-09-22T18:39:17Z","messageCount":4,"participants":["skillzero@gmail.com","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"151308","messageId":"AANLkTinafiikD0Lzgw2gw1ti2pCK6cSTk5bQZFcCRJnS@mail.gmail.com","threadId":"25200","inReplyTo":null,"subject":"Restore annotated tag?","fromName":"","fromEmail":"skillzero@gmail.com","sentAt":"2010-09-22T18:14:28Z","receivedAt":"2010-09-22T18:14:28Z","isPatch":false,"sender":{"key":"skillzero@gmail.com","avatar":null},"body":"Is there a way to restore an annotated tag? One was accidentally\ndeleted and pushed. I can restore normal tags by just using git tag\nagain, but for an annotated tag, there's a tag object and I'm not sure\nhow to restore it.\n"},{"id":"151310","messageId":"20100922182353.GO32601@spearce.org","threadId":"25200","inReplyTo":"AANLkTinafiikD0Lzgw2gw1ti2pCK6cSTk5bQZFcCRJnS@mail.gmail.com","subject":"Re: Restore annotated tag?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2010-09-22T18:23:53Z","receivedAt":"2010-09-22T18:23:53Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"skillzero@gmail.com wrote:\n> Is there a way to restore an annotated tag? One was accidentally\n> deleted and pushed. I can restore normal tags by just using git tag\n> again, but for an annotated tag, there's a tag object and I'm not sure\n> how to restore it.\n\nIf the tag still exists, `git fsck --unreachable | grep tag` should\nshow you output listing the dangling tag objects.  Once you have that\nlist, use `git show SHA1` to view the object.  When you find the tag,\nmake a reference to it with `git update-ref refs/tags/NAME SHA1`.\n\n-- \nShawn.\n"},{"id":"151311","messageId":"AANLkTingnVMsRp8+r5-D=c-7mxfaMY1V06YXT2FQzAoL@mail.gmail.com","threadId":"25200","inReplyTo":"20100922182353.GO32601@spearce.org","subject":"Re: Restore annotated tag?","fromName":"","fromEmail":"skillzero@gmail.com","sentAt":"2010-09-22T18:38:13Z","receivedAt":"2010-09-22T18:38:13Z","isPatch":false,"sender":{"key":"skillzero@gmail.com","avatar":null},"body":"On Wed, Sep 22, 2010 at 11:23 AM, Shawn O. Pearce <spearce@spearce.org> wrote:\n> skillzero@gmail.com wrote:\n>> Is there a way to restore an annotated tag? One was accidentally\n>> deleted and pushed. I can restore normal tags by just using git tag\n>> again, but for an annotated tag, there's a tag object and I'm not sure\n>> how to restore it.\n>\n> If the tag still exists, `git fsck --unreachable | grep tag` should\n> show you output listing the dangling tag objects.  Once you have that\n> list, use `git show SHA1` to view the object.  When you find the tag,\n> make a reference to it with `git update-ref refs/tags/NAME SHA1`.\n\nThanks, that worked.\n\nOne thing I noticed that I wasn't sure about is that I SSH'd into the\nserver and ran git update-ref to restore the tag. That created the\nsymbolic name in .git/refs/tags/NAME to point to that tag object. But\nwhat I noticed is that the only file listed in .git/refs/tags is the\ntag I restored. There are other tags in the repository (and a fresh\nclone gets them), but they don't show up in that directory. Is it\ngoing to be a problem that ran git update-ref on the server (which is\na bare repository) rather than on a clone that I push? I just want to\nmake sure that the tag objects are referenced so they don't go away\nafter the 2 week garbage collection grace period.\n"},{"id":"151312","messageId":"20100922183917.GP32601@spearce.org","threadId":"25200","inReplyTo":"AANLkTingnVMsRp8+r5-D=c-7mxfaMY1V06YXT2FQzAoL@mail.gmail.com","subject":"Re: Restore annotated tag?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2010-09-22T18:39:17Z","receivedAt":"2010-09-22T18:39:17Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"skillzero@gmail.com wrote:\n> \n> One thing I noticed that I wasn't sure about is that I SSH'd into the\n> server and ran git update-ref to restore the tag. That created the\n> symbolic name in .git/refs/tags/NAME to point to that tag object. But\n> what I noticed is that the only file listed in .git/refs/tags is the\n> tag I restored. There are other tags in the repository (and a fresh\n> clone gets them), but they don't show up in that directory.\n\nThe other tags are in the .git/packed-refs file.\n\n> Is it\n> going to be a problem that ran git update-ref on the server (which is\n> a bare repository) rather than on a clone that I push?\n\nNo.\n\n-- \nShawn.\n"}]}