What happens to git commits created in a detached HEAD state?

The old commit is still in the reflog.

git reflog

This will show a list of commits, and the “lost” commit should be in there. You can make it into a new branch. For example, if the SHA-1 is ba5a739, then you can make a new branch named “new-branch” at the old commit with:

git branch new-branch ba5a739

Note that “lost” commits will get deleted when the database is pruned.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)