Search code examples
gitgit-reflog

Where does git store its reflog?


I know that compressed version of reflog is stored in .git/packed-refs but where is actual reflog is located and how git restores history when one types git reflog ?


Solution

  • The reflogs are in .git/logs/<refname>. For example, for a branch named master (eg, refs/heads/master) then you would want .git/logs/refs/heads/master.

    HEAD, of course, is anomalous, and is .git/logs/HEAD.