{"id":"f663c818-9329-453e-a491-70b1cf5d3c34","task":"Recover commits lost to a reset, rebase, or branch deletion using git reflog","domain":"git-scm.com","steps":["Run `git reflog` (aliases to `git log -g`) to see the recent history of HEAD movements, each line prefixed by a position like `HEAD@{0}`, `HEAD@{1}`, etc., with the shortened commit SHA.","Find the entry whose commit hash matches the state you want to restore; positions increase with age, so `HEAD@{2}` is where HEAD was two moves ago.","Recover the commit-by creating a branch at it: `git branch recover <sha>` or `git checkout -b recover <sha>`. Alternatively restore the branch pointer with `git reset --hard <sha>` (only if you do not need the intervening commits).","For refs other than HEAD, query specifically: `git reflog show <branch>` or `git reflog show master`, and use time syntax like `master@{one.week.ago}`.","Verify the restored tree with `git log` and `git status` before continuing work.","Official docs: https://git-scm.com/docs/git-reflog"],"gotchas":["Reflog entries expire: reachable entries default to `gc.reflogExpire` (90 days) and unreachable ones to `gc.reflogExpireUnreachable` (30 days), so recover lost commits promptly or prolonged history is pruned by `git gc`.","The reflog is LOCAL to your repository; a commit never pushed is gone from other clones even if it survives in your reflog.","`git reflog expire` / `drop` remove entries; avoid running them if you think you may need to recover something.","Rebasing/resetting moves HEAD, which is exactly why the reflog records the pre-operation tips — the previous tip is always at `HEAD@{1}` right after an operation."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T11:35:14.981Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-11T11:35:14.981Z"},"url":"https://mcp.waymark.network/r/f663c818-9329-453e-a491-70b1cf5d3c34"}