Xcode 13: How to revert changes in side-by-side comparison?

Hello there!

In Xcode 13 I've lost an ability to revert changes in side-by-side comparison. There were buttons located in the center vertical line that separated two versions of the same file. Now these buttons are gone :(

Any suggestions where I can find them or how I can reset changes?

PS "reset" button resets commits selection

Accepted Reply

On the far left, in the gutter, I get a vertical blue bar.
Clicking that shows the option "Discard Change"

Is that what you want?

  • I find that to be a very weak answer. The functionality was removed and the above is an answer for a very specific case. This is a disappointing regression. "Worked on xCode 12" should not be a statement for things like this.

  • Thank you. I like using the "Discard Change" action and I could not figure out where they moved it in Xcode 13. I think the previous implementation was better.

Add a Comment

Replies

On the far left, in the gutter, I get a vertical blue bar.
Clicking that shows the option "Discard Change"

Is that what you want?

  • I find that to be a very weak answer. The functionality was removed and the above is an answer for a very specific case. This is a disappointing regression. "Worked on xCode 12" should not be a statement for things like this.

  • Thank you. I like using the "Discard Change" action and I could not figure out where they moved it in Xcode 13. I think the previous implementation was better.

Add a Comment

Hmm, it looks like it only appears (vertical blue bar) if a commit on the right side is located earlier in history than a commit on the left side. If you try to swap them - changes are visible but vertical blue bar is not here anymore

Below the Add button in the toolbar is a set of three buttons. Click the middle button snd choose Side By Side Comparison to use side-by-side comparison.

To be able to revert changes you should work with 'Local Changes', not some point in history. This option is avaliable only on the left side of side-by-side mode.

To combine the excellent advice in this thread, all of which I had to follow to get this to work in Xcode 13:

Select Enable Code Review

Select side-by-side comparison from Adjust Editor Options

(the center button with horizontal lines in the image below)

Find the comparison arrow

at the bottom right of the content window,

Select the branch and commit hash you'd like to revert

on the right hand side of the code review selection arrows. (If your project has a large history, it may take some time for the commit hash list to populate.)

Choose Local Changes / Uncommitted Changes

on the left hand side of the code review selection arrows. This may be already selected, but you may need to reselect Local Changes if you've been mucking about with options for awhile.

Correctness check:

Your commit selection area should now look something like this:

Find the change and discard it

Now scroll to a change and click the blue bar in the gutter of the left-side editor. This will reveal the "Discard Change" action you've been dreaming of!

  • Edit: The one heading should be "Select the commit and hash you'd like to revert TO" on the right

Add a Comment

This was so useful feature, now it's SO broken. Apple please bring it back (revert if possible)

The feature is still available in the 'Commit' window when you're saving your entire project back into source control (menu 'Source Control', menu item 'Commit...'). The arrangement of controls along the bottom of the window is also the same as before. It seems this new, changed interface only appears in the side-by-side 'Code Review' window.

Not as useful if you just want to compare and perhaps revert changes in a single file. I second the motion that Apple make the old behavior available as an option to this new "improved" design.