Best Practices
Safe force-push protocol
When history rewrite is necessary, use explicit communication, freeze windows, and `--force-with-lease` to reduce overwrite risk.
- Individuals or teams who want more predictable Git habits
- Maintainers setting collaboration expectations
- At least one real collaboration loop
- Basic command familiarity without a stable routine yet
- Treating guidance as absolute law without context
- Memorizing process without understanding team boundaries
Force-push should be governed, not improvised.
Minimal protocol
- restrict allowed branches
- announce temporary push freeze
- default to
--force-with-lease - share post-push recovery guidance
Confirm no one based on current branchCreate backupUse --force-with-lease
Does not overwrite others' workRecoverableTeam can sync
--force-with-lease is the safe version of force-push; it checks whether remote matches expectations.
Recommended sequence
git fetch origin
git log --oneline --graph --decorate -20
git push --force-with-lease origin <branch>
Why lease matters
--force-with-lease prevents overwriting remote commits you have not seen.
The collaboration recovery cost is often much higher than the history-cleanliness benefit.
Good follow-up reads
shared history boundariesassess force-push impactreview and safe push