Rakshit
1 Mar 2022
General
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?
Ref: Git
Gulafsan Shaheen
1 Mar 2022
Best Answer
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.
Rakshit
1 Mar 2022
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.
© 2024 Copyrights reserved for web-brackets.com