A force-push to main wiped 14 commits from the visible history, causing a 47-minute release block. The commits were recoverable via git reflog in six minutes. The post walks through the exact recovery sequence: fetching the remote reflog, identifying the last good commit hash, creating a named recovery branch, and restoring main with --force-with-lease. It also covers fallback strategies when reflog is empty (local clones, git fsck), and the guardrails added afterward: branch protection, a --force-with-lease alias, a pre-push hook blocking force to protected branches, and quarterly Git disaster drills.

8m read timeFrom blog.stackademic.com
Post cover image
Table of contents
Force-push is not delete. It’s hide. Reflog is the map back.What force-push actually doesThe recovery sequence — copy-paste orderWhen reflog is emptyThe guardrails we added same dayReflog is not a backup strategy
24.9K Impressions2 Comments