Git bare repo – /refs/head/master deleted – How to get last commit id?
I have a bare repository.
For unknown reasons the
/refs/head/master file got deleted.
Because I don’t know the id of the latest commit, I wonder how can I recover it so that I can recreate the master file (holding the id).
One Solution collect form web for “Git bare repo – /refs/head/master deleted – How to get last commit id?”
git reflog to find where your HEAD has been.
Note the hash of the appropriate commit and do
git branch master <hash>