It may be hard to believe, but I was in the middle of a commit when my power went out. Fortunately, I never pushed a commit. I just returned my power, and when I tried to execute git login the directory, and I got an error:
fatal: bad default revision 'HEAD'
This is a private repository, on which I worked a little more than a week and made about 5-10 commits.
I looked at SO and found Git tracking the entire home directory. Get error - fatal: bad default revision 'HEAD' , which did not help, because I already ran it git init!
I just ran ls -lato see if my file was still there .gitignore, but now it disappeared. What should I do? I do not want to lose my previous story.
My git knowledge is limited. Any help would be appreciated.
Change 1:
I have only one branch (master), and when I tried: git symbolic-ref HEAD refs/heads/masternothing has changed.
I also looked through the Git log and show on a bare repo and tried:
git log --graph --oneline --date-order --decorate --color --all
who gave me:
095cdaa (origin/master) added profile layout
dd9ddec fixed nav bar
4e99ca7 remove unecessary files, add resources, start navigation drawer
8b09709 fix README
c64c422 initial commit
Then I tried git branch master 095cdaa..., which gave me an error:
fatal: Failed to resolve HEAD as a valid ref.
Edit 2:
As a quick fix to this problem, I did what @PaulGriffiths suggested:
- Clone Storage
- Copy the modified files and copy them
- Run
rm -f ./.git/index.lock