... but
git log -g
doesn't see this commit
Commits that are (still) referenced by the reflog are considered reachable and not dangling. Thus running git log –g
is contrary to what you wanted, so no surprises here.
Commits will be reachable via reflog for the gc.reflogExpire timespan, with a default of 90 days.
Is there a prettier version of this?
No, git fsck
is the right way for accessing dangling commits.