Rakshit
Published in : 2022-03-01
Something went wrong while I was doing some action with git as given below,
When I hit command “git checkout master”, my computer gets an unexpected force shut down twice. (I never tried the same more than that). After that, I turned on PC (Running with Windows 7 since last 5+ years) and was observing files under my master branch, it shows all files marked as new files.
If I hit git log command, it shows below error:
> git log
fatal: your current branch appears to be broken
Is there any way to restore my branch without deleting it?
Gulafsan Shaheen Date : 2022-03-01
Best answers
1
Best answers
1
Once I was facing the same error when I renamed the folder and the hash was broken up, I solved it by cloning the repository to a new directory and replacing updated files. I see only it is the safe way.
Alternatively, you can remove “.git\refs\heads\ ”, it will fix your issue, but before removing backup your new files.
Thanks.
I cloned the folder to another directory and merged my 30+ files with it. Now it is working fine. It saved me from heart attack.
I'm afraid to remove .git or related folders.
Join our community and get the chance to solve your code issues & share your opinion with us
Sign up Now