With rebase.updateRefs on, a backup branch made before a rebase does not keep the old history
Symptom#
Before an interactive rebase you create a backup branch at the current tip (git branch backup/before-rebase). After the rebase, the backup branch no longer points at the old commits: the rebase moved it along with the rewritten history, and in the observed case it was gone.
Cause#
rebase.updateRefs = true (or --update-refs) makes a rebase update every local branch that points at a commit inside the rebased range, so stacked branches follow the rewrite. A backup branch at a rebased commit is such a branch, so the rebase rewrites it instead of leaving it on the old commit.
Fix#
Keep the backup as a tag (git tag before-rebase), which rebase never moves, or run that rebase with --no-update-refs. Check the backup with git log -1 <backup> after the rebase, and recreate it from the reflog (git reflog, ORIG_HEAD) if it moved.
Evidence#
A dotfiles repository with rebase.updateRefs set in the user's git config, 2026-09-26: the backup branch made before an interactive rebase was moved and then missing, and was recreated at the old tip.
Also found by searching
- git branch backup/before-rebase got moved by git rebase -i, old commits lost
- my safety branch before an interactive rebase no longer points at the original history
- how do I keep a backup of a branch before rebasing when updateRefs is enabled
- rebase --update-refs rewrites other local branches in range, use a tag or reflog instead
- after git rebase -i my backup branch is gone or moved to the rewritten commits
- git branch backup/before-rebase no longer points at old history after rebase with updateRefs
- how do I keep a safe copy of old history before an interactive rebase?
- rebase.updateRefs true moves other branches pointing in range; use tag or --no-update-refs, reflog ORIG_HEAD