Hosting Operations
Read-onlyFind a Discarded Commit in Reflog
Someone ran reset during incident work and you need to locate the commit that disappeared from the branch tip.
Command
cd /lab/git-recovery-rollback && git reflog --date=iso --format='%h %gd %gs' -6
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not wait weeks to inspect reflog; entries can expire or be pruned.
Expected output
Recent reflog entries showing a reset and the discarded incident-note commit.
System impact
Read-only. Nothing changes. Git prints recent HEAD movements from the reflog.
Recovery / rollback: no state is changed.
When to use it
Use after an accidental reset, checkout, commit amend, or branch movement.
When not to use it
Do not wait weeks to inspect reflog; entries can expire or be pruned.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ cd /work/git-recovery-rollback && git reflog --date=iso --format='%h %gd %gs' -6
de583c6 HEAD@{2026-06-26 00:27:37 +0000} reset: moving to HEAD~1
7e5872b HEAD@{2026-06-25 10:45:00 +0000} commit: Capture incident rollback note
de583c6 HEAD@{2026-06-25 10:30:00 +0000} commit: Release 2026-06-25 10:30
c15c7c6 HEAD@{2026-06-25 10:00:00 +0000} commit: Release 2026-06-25 10:00
ddb9d51 HEAD@{2026-06-24 17:00:00 +0000} commit (initial): Release 2026-06-24 17:00
$ cd /work/git-recovery-rollback && git show -s --format='%h %s' HEAD@{1}
7e5872b Capture incident rollback note
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
cd /lab/git-recovery-rollback && git reflog --date=iso --format='%h %gd %gs' -6cd /lab/git-recovery-rollback && git show -s --format='%h %s' HEAD@{1}
next steps
Related commands
Branch a Recovered Commit
Put a name on the reflog commit before it slips away.
cd /lab/git-recovery-rollback && git branch recovered-incident-note HEAD@{1}
Snapshot Git Status Before Recovery
Before rollback commands, capture the branch and dirty files.
cd /lab/git-recovery-rollback && git status --short --branch
Map Recent Release Commits
A rollback is easier when the last few release tags are visible.
cd /lab/git-recovery-rollback && git log --oneline --decorate --graph --all -8
Revert the Suspect Release Commit
Undo a bad release with a new commit instead of rewriting history.
cd /lab/git-recovery-rollback && git restore -- app/config.yml && git revert --no-edit release-2026-06-25-1030
Preview the Patch a Rollback Would Apply
Show the exact file changes before moving the branch back.
cd /lab/git-recovery-rollback && git diff --stat HEAD..release-2026-06-25-1000
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.