gitgit-commitgit-gc

git recreate refs/heads/master after gc


after I run git gc --prune=now the file .git/refs/heads/master is deleted

how to recreate it? a remote application needs to read its text content (commit hash)

.git/HEAD content : ref: refs/heads/master


Solution

  • git ls-remote <repo> refs/heads/master is the solution, it works with both local and remote repositories