A branch can move away from a commit without immediately destroying the commit object. Git’s reflog records recent local movements of references, including HEAD. If a private reset moved a branch away from a wanted commit, inspect the local record:
git reflog
git show <old-commit-id>
Replace the placeholder with the candidate ID shown by the reflog; verify the commit’s message and contents. If it is the wanted committed tip, preserve it under an unused branch name:
git branch recovered-work <old-commit-id>
This creates a reference without switching branches or altering working files. Check it with git log --oneline recovered-work and compare its content before deciding how to integrate it. The name recovered-work must not already exist.
Reflogs are local to a repository, not shared automatically. Entries expire, and unreachable objects can eventually be pruned, so an old tip may no longer be available. Reflog tracks reference movements, not a timeline of every edit: it cannot reliably restore never-committed working changes. Staged content may exist as objects but finding it is uncertain. Independent backups remain important. If the data is important and the candidate is missing, stop destructive cleanup and seek a recovery approach rather than assuming another reset will help.