I don't know how it happened, but I had a data loss and was only left with a .git
directory containing only an objects
directory.
I've followed the steps from Recovering Git repository from objects only:
- Created a new directory and ran
git init
- Copied the
objects
directory I had to the new.git/objects
directory - Ran
git fsck
command.
The output of the above steps produced the following msg:
notice: HEAD points to an unborn branch (master)
notice: No default references
dangling commit 0b2c7d52b6a7e6d4e2858e9ebf207c315407c87c
dangling commit 8dceafea1634c923069f6d4b925839c28d92c4e5
dangling commit dd7bdd04c557a018c15fd0948075121f181decd1
When I try to run git log
at this stage I get fatal: bad default revision 'HEAD'
.
What should I do in order to recover my data???
EDIT:
klaustopher's suggestion:
- I added a file under
/refs/heads
calledmaster
containing one of the dangling commits. - The msg I got in return was
fatal: unable to read tree 3c864da48b16ad0dc5f8ae585380270a708a1e56
- I checked and there is no 3c directory under "objects"...