git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Restore annotated tag?
@ 2010-09-22 18:14 skillzero
  2010-09-22 18:23 ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: skillzero @ 2010-09-22 18:14 UTC (permalink / raw)
  To: Git Mailing List

Is there a way to restore an annotated tag? One was accidentally
deleted and pushed. I can restore normal tags by just using git tag
again, but for an annotated tag, there's a tag object and I'm not sure
how to restore it.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Restore annotated tag?
  2010-09-22 18:14 Restore annotated tag? skillzero
@ 2010-09-22 18:23 ` Shawn O. Pearce
  2010-09-22 18:38   ` skillzero
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn O. Pearce @ 2010-09-22 18:23 UTC (permalink / raw)
  To: skillzero; +Cc: Git Mailing List

skillzero@gmail.com wrote:
> Is there a way to restore an annotated tag? One was accidentally
> deleted and pushed. I can restore normal tags by just using git tag
> again, but for an annotated tag, there's a tag object and I'm not sure
> how to restore it.

If the tag still exists, `git fsck --unreachable | grep tag` should
show you output listing the dangling tag objects.  Once you have that
list, use `git show SHA1` to view the object.  When you find the tag,
make a reference to it with `git update-ref refs/tags/NAME SHA1`.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Restore annotated tag?
  2010-09-22 18:23 ` Shawn O. Pearce
@ 2010-09-22 18:38   ` skillzero
  2010-09-22 18:39     ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: skillzero @ 2010-09-22 18:38 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Git Mailing List

On Wed, Sep 22, 2010 at 11:23 AM, Shawn O. Pearce <spearce@spearce.org> wrote:
> skillzero@gmail.com wrote:
>> Is there a way to restore an annotated tag? One was accidentally
>> deleted and pushed. I can restore normal tags by just using git tag
>> again, but for an annotated tag, there's a tag object and I'm not sure
>> how to restore it.
>
> If the tag still exists, `git fsck --unreachable | grep tag` should
> show you output listing the dangling tag objects.  Once you have that
> list, use `git show SHA1` to view the object.  When you find the tag,
> make a reference to it with `git update-ref refs/tags/NAME SHA1`.

Thanks, that worked.

One thing I noticed that I wasn't sure about is that I SSH'd into the
server and ran git update-ref to restore the tag. That created the
symbolic name in .git/refs/tags/NAME to point to that tag object. But
what I noticed is that the only file listed in .git/refs/tags is the
tag I restored. There are other tags in the repository (and a fresh
clone gets them), but they don't show up in that directory. Is it
going to be a problem that ran git update-ref on the server (which is
a bare repository) rather than on a clone that I push? I just want to
make sure that the tag objects are referenced so they don't go away
after the 2 week garbage collection grace period.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Restore annotated tag?
  2010-09-22 18:38   ` skillzero
@ 2010-09-22 18:39     ` Shawn O. Pearce
  0 siblings, 0 replies; 4+ messages in thread
From: Shawn O. Pearce @ 2010-09-22 18:39 UTC (permalink / raw)
  To: skillzero; +Cc: Git Mailing List

skillzero@gmail.com wrote:
> 
> One thing I noticed that I wasn't sure about is that I SSH'd into the
> server and ran git update-ref to restore the tag. That created the
> symbolic name in .git/refs/tags/NAME to point to that tag object. But
> what I noticed is that the only file listed in .git/refs/tags is the
> tag I restored. There are other tags in the repository (and a fresh
> clone gets them), but they don't show up in that directory.

The other tags are in the .git/packed-refs file.

> Is it
> going to be a problem that ran git update-ref on the server (which is
> a bare repository) rather than on a clone that I push?

No.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-22 18:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-22 18:14 Restore annotated tag? skillzero
2010-09-22 18:23 ` Shawn O. Pearce
2010-09-22 18:38   ` skillzero
2010-09-22 18:39     ` Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).