What non-interactive git command(s) achieve the change from Before to After?

Before:

A---B---C---D

After:

A---C'---B'---D'
Edit
Report