Fix PR13851: Preserve metadata for the unswitched branch