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.

  • Import all of the source code to Bitbucket Git initially
  • git fast-forward one commit
  • Git submodules workflow
  • How to find which actual command is executed in terminal
  • Filter Git log for commits that don't contain a specific word
  • git rebase favoring my branch
  • 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).

  • How can I automagically make a checkout upon push?
  • Mercurial and Git custom SSH key location
  • Git - Log commits of dev except which are cherry-picked into main
  • Accessing a git repository via ssh behind a firewall
  • How to pack commits in git
  • looking up svn content by hash
  • One Solution collect form web for “Git bare repo – /refs/head/master deleted – How to get last commit id?”

    Use git reflog to find where your HEAD has been.

    Note the hash of the appropriate commit and do git branch master <hash>

    Git Baby is a git and github fan, let's start git clone.