简体   繁体   中英

How to recover git repository data if system was crashed during switching branches?

I was switching branch in jboss developer studio (just like eclipse) . It asked me to commit your changes before switching. I entered temporary commit as commit message. Then IDE was doing it's work.

But when IDE was doing all this, system was crashed due to unavailability of electricity.

When power was back I saw much of my files were blank, IDE is not recognizing project as git project, git status is saying not a git repository .

How can I recover git repository data if system was crashed during switching branches?

Try to check what's inside the reflog, with :

git reflog 

If you are lucky enough you should find the temporary commit into the reflog list, and then you can restore it from there.

In the case you won't find anything inside the reflog try with this command :

git fsck --full --no-reflogs --unreachable --lost-found

The listed commits are copied into .git/lost-found/commit/ , and non-commit objects are copied into .git/lost-found/other/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM