xxxxxxxxxx
#Do following to solve "Failed to resolve HEAD as a valid ref." issue.
1-Clone your same project in another different folder.
2-Copy the (hidden) .git folder of the cloned project.
3-Replace the .git folder of the original project with the one copied.
Problem solved! ;)