git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: how to recovery corrupted git blob

From
Christian Couder <christian.couder@gmail.com>
Date
Dec 26, 2013, 09:32 UTC
Message-ID
<CAP8UFD201zWb4nnzG+n7xjr+7Q+8CyzG_z+AavCFT=AAjMgm6g@mail.gmail.com>
In-Reply-To
<1388046906300-7601221.post@n2.nabble.com>
Hi,
On Thu, Dec 26, 2013 at 9:35 AM, Yvonne Leroy <articulation7@gmail.com> wrote:
>
> 1- at the beginning, with "git fsck --full", it showed:
[...]
> missing blob e187557d07857b974ea51e3ea962ac120cfc9488
[...]
Show 7 quoted lines
> commit e415bb6d51ee05d60055d89f2bf63ccb32f4c12c
> Author: Yvonne Leroy <articulation7@gmail.com>
> Date:   Sun Dec 15 23:40:39 2013 +0800
>
>     index on master: ec5e609 list
>
> :100644 100644 595691a... e187557... M  project5/css/style.css

The above show you that the previous version of the blob was 595691a. But in the output you showed there was no line with something like:

> :100644 100644 e187557... <newversion>... M  project5/css/style.css
So we know the previous version but not the subsequent version of that file.
Could you check again that there is no subsequent version with something like:
git log --raw --all --full-history -- project5/css/style.css | grep e187557
?
[...]
> 5-here is my problem,how can I looking at those older and newer
> versions(Could someone point me to which commands I should look at? Still
> new to git:))
You can use "git cat-file blob 595691a" to look at the previous version.
> so that I can use the next step    git hash-object -w <recreated-file>
> and could someone tell me what should I do with <recreated-file>,is it still
> project5/css/style.css ?

If "git hash-object -w <recreated-file>" results in e187557d07857b974ea51e3ea962ac120cfc9488 then it means that the missing blob was successfully rewritten into your git repo, so everything should be fine after that. To make sure you can run "git fsck" again.

Note that you are trying to recreate the missing blob, but in my opinion before trying to do that you should probably try to find the missing blob in another repo. The log above showed that the missing blob was created on the 15th of December (Sun Dec 15 23:40:39 2013 +0800). Haven't you pushed your repo somewhere since that day? If you did push, it's probably easier to get the missing blob from where you pushed.

Regards, Christian.

Previous: Yvonne Leroy
Message 2 of 2 in “how to recovery corrupted git blob”
  1. Yvonne LeroyDec 26, 2013
  2. Christian CouderDec 26, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.