Re: [Question] Git recovery with HEAD commit broken

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

 



Shilong Wang <wangshilong1991@xxxxxxxxx> writes:

> A power off cause my top commit broken, and then git
> branch/log/reflog..etc won't work.

With a bit of luck, the reflog actually contain useful information. Look
at .git/logs/HEAD (or refs/heads/* instead of HEAD for branches'
reflog). It's a human-readable text format. You should be able to walk
up the history looking for a good commit.

> I do a hack that

Before anything else: do a backup of your full repository while it's
still time.

> i change the HEAD commit to the one that i can make sure is right,

(don't forget to run "git fsck" to make sure that not only the commit
but also its ancestry is right).

> In fact, i hope git fsck can fix up such problems(maybe can backup top
> commit for example)...

Not as far as I know. But "git fsck" has a --lost-found option that can
help recovering unreachable (dangling) commits.

You may have a look at http://hackage.haskell.org/package/git-repair but
I do not think it would solve your particular case.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
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]