seniorGit

What is Git reflog and how can it save you from data loss?

Updated Apr 23, 2026

Short answer

Reflog records local reference updates, allowing recovery of lost commits.

Deep explanation

Reflog tracks movements of HEAD and branch refs (checkouts, resets, rebases). Even if commits are orphaned, reflog retains pointers for a period, enabling recovery. It’s local-only and expires per GC settings.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Git interview questions

View all →