ProjectStack
git

warning: reflog of 'HEAD' references a broken commit

The reflog (the history of where HEAD has pointed) references a commit object that no longer exists or is corrupt in the object store. This usually means some history was lost.

Common causes

  • A git gc or git prune removed objects that the reflog still references
  • Repo was transferred or cloned in a way that didn't include all objects
  • Object store corruption from a disk or filesystem issue
  • A shallow clone missing full history

How to fix it

  1. This is often just a warning — run git fsck to see if there are real errors: git fsck --full
  2. Clean up dangling refs: git gc --prune=now
  3. Expire old reflog entries: git reflog expire --all --expire=now
  4. If critical history is missing, check if the remote still has it: git fetch --all

Example

warning: reflog of 'HEAD' references a broken commit. warning: reflog of 'refs/heads/main' references a broken commit.

Running git gc or git fsck after object store corruption

Have a different error?

Paste any error message into the Error Translator to get an instant explanation.