Repair corrupted Git repository

前端 未结 9 1436
执念已碎
执念已碎 2020-11-30 06:27

My Git repository got corrupted after a couple of hard reboots due to power supply issues and now I\'m unable to fix it (I was in the middle of staging some files at the las

9条回答
  •  没有蜡笔的小新
    2020-11-30 06:54

    Another alternative which worked for me was to reset the Git head and index to its previous state using:

    git reset --keep
    

    I also tried the following commands, but they did not work for me, but they might for you:

    git reset --mixed
    git fsck --full
    git gc --auto
    git prune --expire now
    git reflog --all
    

提交回复
热议问题