Repair corrupted Git repository

前端 未结 9 1435
执念已碎
执念已碎 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 07:01

    The most simple solution for me: You should git clone in a new folder, then replace the clean new_folder/.git to the old folder (the broken folder). It has worked well for me!

    git clone ...(remote) new_folder
    mv old_folder/.git  old_folder/.git_old
    cp -R new_folder/.git  old_folder/
    

提交回复
热议问题