Recovery
Assess the impact after a force push
After a force push, the urgent task is not another push. First identify which refs were replaced, who may still depend on the old history, and what recovery window still exists.
- Anyone actively handling a Git mistake
- Readers who want a conservative rescue habit before trouble happens
- Stop mutating the repo further
- Be ready to inspect `git reflog`, `git status`, and `git log --graph`
- Running more reset or rebase commands before preserving a checkpoint
- Changing shared history before assessing blast radius
The first move is not “force push again”
The real questions are:
- which branch did you overwrite
- whether anyone else may still depend on the old history
- whether the old position is still recoverable
This is as much a collaboration problem as a Git command problem.
First round of checks
git fetch origin
git log --oneline --graph --decorate --all -n 40
git reflog
Use that to determine:
- where your local branch pointed before the force push
- where the remote branch points now
- whether the old commits are still easy to name
Three priority questions
1. Is this a personal branch or a shared branch?
If it is a personal branch that nobody else relies on, recovery is usually much simpler.
If it is shared, the blast radius is immediately larger.
2. Has anyone already continued from the old history?
This is the most important question.
If others already pulled or branched from the old commits, the problem is no longer just “fix my branch.” It becomes “restore a shared understanding of history.”
3. Is the old position still recoverable?
If the old commit is still visible in reflog or another ref, create a rescue branch first:
git switch -c rescue/pre-force HEAD@{1}
Why --force-with-lease is safer
It is not merely a “gentler” force push. It adds a safety check that refuses to overwrite the remote if it changed unexpectedly since your last known view.
That does not replace communication, but it prevents a class of avoidable accidents.
A practical response order
- Stop pushing for a moment
- Find the pre-force position in reflog
- Create a rescue branch
- Decide whether the remote branch must be restored
- If the branch is shared, align the team before more rewriting
When communication comes before commands
Communication should usually come first when:
- the overwritten branch is shared
- release or CI flow depends on it
- you are unsure whether teammates already synced the old history
One good rule
The expensive part of a bad force push is often not recovering the commits.
It is recovering the team’s shared mental model of the branch.