Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: Git screwup with reset

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:46:47

jake varghese [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help