Whenever I try to commit my work, I get this error.
fatal: could not parse HEAD
What should I do if I want to preserve my changes?
Do you know what branch HEAD
was supposed to point to? Was it master
? Run git symbolic-ref HEAD refs/heads/master
.
Basically, the symbolic reference with the name HEAD
is corrupted somehow. You (or software you ran) must have gone poking around the .git
dir. If I were you I would check to make sure nothing else in your repo is damaged. You can verify your object database by running git fsck
.
Copy the new files you recently changed to another directory, delete the git local repository in your computer, clone the repository again using 'git clone URL', move the recently changed files your copied to another back to this directory, do git add files, git commit -m " ur msg ", and push to the remote repository using git push
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With