Reputation: 4202
After restarting my computer, 'git commit' & 'git status' both return an error message:
error: bad signature
fatal: index file corrupt
running 'git branch':
fatal: Failed to resolve HEAD as a valid ref.
running 'git log':
fatal: your current branch appears to be broken
What causes this?
How can I restore/fix my local repo/branch?
Upvotes: 3
Views: 4004
Reputation: 4202
I found a solution that worked for me.
.git
folder from newly cloned repo & replace the one in the original repo.This will repair the detached HEAD state which occurred as a result of (in this particular case) uncommitted changes that were discarded (but saved locally) when computer was forced to shut down.
Upvotes: 5