Lithium-rich disordered rocksalt cathodes display high capacities arising from redox chemistry on both transition-metal and oxygen ions and are potential candidates for next-generation lithium-ion batteries. The atomic-scale mechanisms governing this O-redox behaviour, however, are not fully understood. In particular, it is not clear to what extent transition metal migration is required for O-redox and what role this may play in explaining voltage hysteresis in these materials. Here, we reveal an O-redox mechanism linking transition metal migration and O2 formation in the disordered rocksalt Li2MnO2F. At high states of charge, O-ions dimerise to form molecular O2 trapped in the bulk structure, leaving vacant O sites surrounding neighbouring Mn ions. This undercoordination drives Mn movement into new fully-coordinated octahedral sites. Mn displacement can occur irreversibly, which results in voltage hysteresis, with a lower voltage upon discharge as observed experimentally. Alternatively, Mn displacement may take place into interstitial octahedral sites, which permits a reversible return of the Mn ion to its original site upon discharge, recovering the original Li2MnO2F structure and resulting in reversible O-redox without voltage loss. These new findings suggest that reversible transition metal ion migration provides a possible design route to retain the high energy density of O-redox disordered rocksalt cathodes on cycling.