Re: Git screwup with reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



jake varghese <jake@xxxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]