I've created git-repair as a small spinoff from git-annex.


git-repair is a complement to git fsck, which only finds problems, but
does not try to fix them.

At its simplest, git-repair deletes all corrupt objects and corrupt
packs, makes a fresh clone from a remote[1] and rsyncs the missing
objects back into the repository.

If that is not sufficient to fully recover the repository, it can also
reset branches back to commits before the corruption happened, delete
branches that are no longer available due to the lost data, and remove
any missing files from the index. It will only do this if run with the
--force option, since that rewrites history and throws out missing data.

I would be very sad to have to use git-repair --force on a git
repository holding source code, although it might manage to preserve
commits that I had forgotten to push. It's more likely to be useful in a
git repository being used for non-source-code purposes, where the loss
of some files won't break the build of a program.

[1] It would be more efficient if it could git fetch individual missing
    objects from the remote, but my current understanding is that the
    git protocols do not allow doing that.

see shy jo

Attachment: signature.asc
Description: Digital signature

Reply via email to