Benzer bir sorun yaşadım. Git işlemi sırasında dizüstü bilgisayarımın pili bitti. Boo.
Yedeklerim yoktu. (NB Ubuntu One git için bir yedekleme çözümü değildir; akıllıca deponuzun bozuk olanınızla üzerine yazılmasına yardımcı olacaktır.)
Git sihirbazlarına, bu düzeltmenin kötü bir yoluysa, lütfen bir yorum bırakın. Ancak, benim için çalıştı ... en azından geçici olarak.
Adım 1: .git'in bir yedeğini alın (aslında bunu bir şeyi değiştiren her adım arasında yapıyorum, ancak yeni bir kopya adı ile, örneğin .git-old-1, .git-old-2, vb.) :
cp -a .git .git-old
2. Adım: Çalıştırın git fsck --full
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git fsck --full
error: object file .git/objects/8b/61d0135d3195966b443f6c73fb68466264c68e is empty
fatal: loose object 8b61d0135d3195966b443f6c73fb68466264c68e (stored in .git/objects/8b/61d0135d3195966b443f6c73fb68466264c68e) is corrupt
Adım 3: Boş dosyayı kaldırın. Ne halt olduğunu düşündüm; zaten boş.
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ rm .git/objects/8b/61d0135d3195966b443f6c73fb68466264c68e
rm: remove write-protected regular empty file `.git/objects/8b/61d0135d3195966b443f6c73fb68466264c68e'? y
3. Adım: git fsckTekrar çalıştırın . Boş dosyaları silmeye devam edin. Ayrıca edebilirsiniz cdiçine .gitdizin ve çalıştırmak find . -type f -empty -delete -printtüm boş dosyaları kaldırmak için. Sonunda git bana aslında nesne dizinleri ile bir şeyler yaptığını söylemeye başladı:
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git fsck --full
Checking object directories: 100% (256/256), done.
error: object file .git/objects/e0/cbccee33aea970f4887194047141f79a363636 is empty
fatal: loose object e0cbccee33aea970f4887194047141f79a363636 (stored in .git/objects/e0/cbccee33aea970f4887194047141f79a363636) is corrupt
Adım 4: Tüm boş dosyaları sildikten sonra, sonunda git fsckgerçekten çalışmaya başladım :
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git fsck --full
Checking object directories: 100% (256/256), done.
error: HEAD: invalid sha1 pointer af9fc0c5939eee40f6be2ed66381d74ec2be895f
error: refs/heads/master does not point to a valid object!
error: refs/heads/master.u1conflict does not point to a valid object!
error: 0e31469d372551bb2f51a186fa32795e39f94d5c: invalid sha1 pointer in cache-tree
dangling blob 03511c9868b5dbac4ef1343956776ac508c7c2a2
missing blob 8b61d0135d3195966b443f6c73fb68466264c68e
missing blob e89896b1282fbae6cf046bf21b62dd275aaa32f4
dangling blob dd09f7f1f033632b7ef90876d6802f5b5fede79a
missing blob caab8e3d18f2b8c8947f79af7885cdeeeae192fd
missing blob e4cf65ddf80338d50ecd4abcf1caf1de3127c229
5. Adım: Deneyin git reflog. Başarısız çünkü KAFA kırıldı.
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git reflog
fatal: bad object HEAD
6. Adım: Google. Bunu bul . Reflog'un son iki satırını manuel olarak alın:
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ tail -n 2 .git/logs/refs/heads/master
f2d4c4868ec7719317a8fce9dc18c4f2e00ede04 9f0abf890b113a287e10d56b66dbab66adc1662d Nathan VanHoudnos <nathanvan@gmail.com> 1347306977 -0400 commit: up to p. 24, including correcting spelling of my name
9f0abf890b113a287e10d56b66dbab66adc1662d af9fc0c5939eee40f6be2ed66381d74ec2be895f Nathan VanHoudnos <nathanvan@gmail.com> 1347358589 -0400 commit: fixed up to page 28
Adım 7: Adım 6'dan itibaren HEAD'in şu anda son taahhüdü işaret ettiğini öğrendiğimizi unutmayın. Öyleyse sadece ebeveyn taahhüdüne bakmaya çalışalım:
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git show 9f0abf890b113a287e10d56b66dbab66adc1662d
commit 9f0abf890b113a287e10d56b66dbab66adc1662d
Author: Nathan VanHoudnos <nathanvan@XXXXXX>
Date: Mon Sep 10 15:56:17 2012 -0400
up to p. 24, including correcting spelling of my name
diff --git a/tex/MCMC-in-IRT.tex b/tex/MCMC-in-IRT.tex
index 86e67a1..b860686 100644
--- a/tex/MCMC-in-IRT.tex
+++ b/tex/MCMC-in-IRT.tex
İşe yaradı!
Adım 8: Şimdi HEAD'ı 9f0abf890b113a287e10d56b66dbab66adc1662d'ye yönlendirmemiz gerekiyor.
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git update-ref HEAD 9f0abf890b113a287e10d56b66dbab66adc1662d
Hangi şikayet etmedi.
Adım 9: FSck'in ne dediğine bakın:
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git fsck --full
Checking object directories: 100% (256/256), done.
error: refs/heads/master.u1conflict does not point to a valid object!
error: 0e31469d372551bb2f51a186fa32795e39f94d5c: invalid sha1 pointer in cache-tree
dangling blob 03511c9868b5dbac4ef1343956776ac508c7c2a2
missing blob 8b61d0135d3195966b443f6c73fb68466264c68e
missing blob e89896b1282fbae6cf046bf21b62dd275aaa32f4
dangling blob dd09f7f1f033632b7ef90876d6802f5b5fede79a
missing blob caab8e3d18f2b8c8947f79af7885cdeeeae192fd
missing blob e4cf65ddf80338d50ecd4abcf1caf1de3127c229
Adım 10: Önbellek ağacındaki geçersiz sha1 işaretçisi, (şimdi eskimiş) bir dizin dosyasından ( kaynak ) gelmiş gibi görünüyordu . Ben de öldürdüm ve repoyu sıfırladım.
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ rm .git/index
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git reset
Unstaged changes after reset:
M tex/MCMC-in-IRT.tex
M tex/recipe-example/build-example-plots.R
M tex/recipe-example/build-failure-plots.R
Adım 11: Fsck'e tekrar bakmak ...
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git fsck --full
Checking object directories: 100% (256/256), done.
error: refs/heads/master.u1conflict does not point to a valid object!
dangling blob 03511c9868b5dbac4ef1343956776ac508c7c2a2
dangling blob dd09f7f1f033632b7ef90876d6802f5b5fede79a
Sarkan lekeler hatalar değildir . Master.u1conflict ile ilgilenmiyorum ve şimdi çalıştığı için artık ona dokunmak istemiyorum!
Adım 12: Yerel düzenlemelerime yetişmek:
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: tex/MCMC-in-IRT.tex
# modified: tex/recipe-example/build-example-plots.R
# modified: tex/recipe-example/build-failure-plots.R
#
< ... snip ... >
no changes added to commit (use "git add" and/or "git commit -a")
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git commit -a -m "recovering from the git fiasco"
[master 7922876] recovering from the git fiasco
3 files changed, 12 insertions(+), 94 deletions(-)
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git add tex/sept2012_code/example-code-testing.R
nathanvan@nathanvan-N61Jq:~/workspace/mcmc-chapter$ git commit -a -m "adding in the example code"
[master 385c023] adding in the example code
1 file changed, 331 insertions(+)
create mode 100644 tex/sept2012_code/example-code-testing.R
Umarım bu gelecekte insanlar için yararlı olabilir. Çalıştığına sevindim.
git addoperasyonu zorla öldürdün mü ? Sabit diskiniz dolu mu?