{"thread":{"id":"35573","subject":"how to recovery corrupted git blob","startedAt":"2013-12-26T08:35:06Z","lastAt":"2013-12-26T09:32:19Z","messageCount":2,"participants":["Yvonne Leroy","Christian Couder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"232394","messageId":"1388046906300-7601221.post@n2.nabble.com","threadId":"35573","inReplyTo":null,"subject":"how to recovery corrupted git blob","fromName":"Yvonne Leroy","fromEmail":"articulation7@gmail.com","sentAt":"2013-12-26T08:35:06Z","receivedAt":"2013-12-26T08:35:06Z","isPatch":false,"sender":{"key":"articulation7@gmail.com","avatar":null},"body":"Hi all, \n\nI have a corrupted git repo.I've worked through the process \nhttps://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F\n<https://git.wiki.kernel.org/index.php/GitFaq#How_to_fix_a_broken_repository.3F> \nbut still have some problem. \n\n1- at the beginning, with \"git fsck --full\", it showed: \n\nChecking object directories: 100% (256/256), done. \ndangling blob 13dcdade560f11e8bc2d865a0d4a1a1133e5b132 \ndangling tree 5c9e60742ff24bb19fd73a8c1c879c4e10951b78 \nmissing blob 96209289c92e6ef0e6beb6ec1644f93981b00829 \ndangling blob f61e50d30fa95683067aa2a50380e3dd7033e6dd \ndangling tree 95b5c5eeec8ac9359a31b268b938c142443d783a \ndangling commit d41b93032b34e380030207b5c8f502c6ecfd56ad \ndangling blob dae58bd96104c1292a20e1b8c8c948025e2e8924 \nmissing blob e187557d07857b974ea51e3ea962ac120cfc9488 \n\n2- since I don't have a \"broken link\" message,I use $ git commit -m \"fixing\ngit repo\",it said: \n\nerror: invalid object 100644 e187557d07857b974ea51e3ea962ac120cfc9488 for\n'proje \nct5/css/style.css' \nerror: Error building trees \n\n3- and then   I use $ git hash-object -w project5/css/style.css, it said: \n\ngit hash-object -w project5/css/style.css \nf61e50d30fa95683067aa2a50380e3dd7033e6dd \n\nthe result is not the missing blob\n(e187557d07857b974ea51e3ea962ac120cfc9488) \n\n4- so I use $ git log --raw --all --full-history -- project5/css/style.css,\nit said: \n\n\ncommit 7b5314a110b8e2835f7f3d068072429be87be574 \nMerge: ec5e609 e415bb6 \nAuthor: Yvonne Leroy <articulation7@gmail.com>\nDate:   Sun Dec 15 23:40:41 2013 +0800 \n\n    WIP on master: ec5e609 list \n\ncommit e415bb6d51ee05d60055d89f2bf63ccb32f4c12c \nAuthor: Yvonne Leroy <articulation7@gmail.com>\nDate:   Sun Dec 15 23:40:39 2013 +0800 \n\n    index on master: ec5e609 list \n\n:100644 100644 595691a... e187557... M  project5/css/style.css \n\ncommit ec76f78324632c3eebd874a724a9ebfe7d1f22ec \nAuthor: Yvonne Leroy <articulation7@gmail.com>\nDate:   Sat Dec 7 14:48:37 2013 +0800 \n\n    nav view \n\n:000000 100644 0000000... 595691a... A  project5/css/style.css \n\n5-here is my problem,how can I looking at those older and newer\nversions(Could someone point me to which commands I should look at? Still\nnew to git:)) \nso that I can use the next step    git hash-object -w <recreated-file>\nand could someone tell me what should I do with <recreated-file>,is it still\nproject5/css/style.css ? \n\nThanks in advance, \nYvonne. \n\n\n\n\n--\nView this message in context: http://git.661346.n2.nabble.com/how-to-recovery-corrupted-git-blob-tp7601221.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"232395","messageId":"CAP8UFD201zWb4nnzG+n7xjr+7Q+8CyzG_z+AavCFT=AAjMgm6g@mail.gmail.com","threadId":"35573","inReplyTo":"1388046906300-7601221.post@n2.nabble.com","subject":"Re: how to recovery corrupted git blob","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2013-12-26T09:32:19Z","receivedAt":"2013-12-26T09:32:19Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Hi,\n\nOn Thu, Dec 26, 2013 at 9:35 AM, Yvonne Leroy <articulation7@gmail.com> wrote:\n>\n> 1- at the beginning, with \"git fsck --full\", it showed:\n\n[...]\n\n> missing blob e187557d07857b974ea51e3ea962ac120cfc9488\n\n[...]\n\n> commit e415bb6d51ee05d60055d89f2bf63ccb32f4c12c\n> Author: Yvonne Leroy <articulation7@gmail.com>\n> Date:   Sun Dec 15 23:40:39 2013 +0800\n>\n>     index on master: ec5e609 list\n>\n> :100644 100644 595691a... e187557... M  project5/css/style.css\n\nThe above show you that the previous version of the blob was 595691a.\nBut in the output you showed there was no line with something like:\n\n> :100644 100644 e187557... <newversion>... M  project5/css/style.css\n\nSo we know the previous version but not the subsequent version of that file.\n\nCould you check again that there is no subsequent version with something like:\n\ngit log --raw --all --full-history -- project5/css/style.css | grep e187557\n\n?\n\n[...]\n\n> 5-here is my problem,how can I looking at those older and newer\n> versions(Could someone point me to which commands I should look at? Still\n> new to git:))\n\nYou can use \"git cat-file blob 595691a\" to look at the previous version.\n\n> so that I can use the next step    git hash-object -w <recreated-file>\n> and could someone tell me what should I do with <recreated-file>,is it still\n> project5/css/style.css ?\n\nIf \"git hash-object -w <recreated-file>\" results in\ne187557d07857b974ea51e3ea962ac120cfc9488\nthen it means that the missing blob was successfully rewritten into\nyour git repo, so everything should be fine after that.\nTo make sure you can run \"git fsck\" again.\n\nNote that you are trying to recreate the missing blob, but in my\nopinion before trying to do that you should probably try to find the\nmissing blob in another repo. The log above showed that the missing\nblob was created on the 15th of December (Sun Dec 15 23:40:39 2013\n+0800). Haven't you pushed your repo somewhere since that day? If you\ndid push, it's probably easier to get the missing blob from where you\npushed.\n\nRegards,\nChristian.\n"}]}