When a parent Git branch is updated, its child branch can keep the old parent commit
A parent branch can match its remote exactly while a child branch still contains the parent's earlier commit, which can make a stacked merge request diff show the parent's changes. The problem was found during a local test for GitLab CLI issue #8283, where the commit graph revealed a mismatch that git status did not. The article demonstrates this in a disposable repository with a local bare remote, where amending the parent and force-pushing it leaves the child pointing at the old commit. An ancestry check fails and the log shows the superseded parent commit still in the child's history. The fix is to confirm the old parent is an ancestor of the child, back up the child, and rebase only the commits after that boundary onto the new parent. The author also advises fetching and inspecting a shared child branch before rewriting its history.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in