git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: jake varghese <jake@orgsync.com>
Cc: git@vger.kernel.org
Subject: Re: Git screwup with reset
Date: Mon, 18 May 2009 08:08:40 -0700	[thread overview]
Message-ID: <20090518150840.GJ30527@spearce.org> (raw)
In-Reply-To: <9D569322-6A7B-4447-962C-0C740945E227@orgsync.com>

jake varghese <jake@orgsync.com> wrote:
> When I run git fsck --lost-found i get a whole bunch of dangling  
> objects.  If I run git show on those objects it shows me the code that 
> was lost.  Anyone know of a way to get this stuff back.  I tried  
> rebasing and merging and neither worked.

For each of those dangling blobs:

  git cat-file blob $sha1 >$path

where you need to manually figure out the relationship between
$sha1 and the local $path within your project.  Git doesn't have
that relationship data, because you never made a commit.

Oh, and next time, commit like every hour, or more frequently than
that.  At worst, you'll need to do a "git merge --squash" near the
end to flatten out your silly "save my work" checkpoints and draft
a more useful commit message for your coworkers.  But at least you
lose less when you have a "git reset --hard" fat finger accident.

-- 
Shawn.

  reply	other threads:[~2009-05-18 15:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-18 14:58 Git screwup with reset jake varghese
2009-05-18 15:08 ` Shawn O. Pearce [this message]
2009-05-18 15:11 ` Sverre Rabbelier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090518150840.GJ30527@spearce.org \
    --to=spearce@spearce.org \
    --cc=git@vger.kernel.org \
    --cc=jake@orgsync.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).