27

Since Xcode 13, code comparison default is no longer a side-by-side diff.

There must be a way of doing this still.

I am struggling to find the option!

Jeff
  • 3,829
  • 1
  • 31
  • 49
Nick Hingston
  • 8,724
  • 3
  • 50
  • 59
  • 1
    I don't want to edit your post, but would like to suggest you add the phrase "side-by-side diff" in it - I only tripped on this because I deleted 'diff' and searched again. Maybe multiple phrases: "side by side git diff", "side by side diff", "side-by-side diff", "side by side code diff". Hmmm - maybe this comment will do that - will try again later. – David H Oct 06 '21 at 15:10
  • I used to search this with "Enable Version Editor in Xcode 13" query - got nothing – Alexey Martemyanov Jan 27 '22 at 06:34
  • There used to be two buttons to cycle through the differences - the buttons where in the bottom center in the Side by Side window. Where did these go in Xcode 14? – Hahnemann May 25 '23 at 03:07

2 Answers2

48

Click on Code Review (the blue button on the screenshot), the one with one arrow to the left and the other one to the right (or in View Menu).

Then, on the second icon, select Side by Side Comparison instead of Inline Comparison (or in Editor Menu).

"Commits list" is at the bottom, on the bar with Enable Breakpoints, etc.

enter image description here

Larme
  • 24,190
  • 6
  • 51
  • 81
  • 4
    I am aghast that this answer hasn't gotten up voted 1000 times!!! Saved my life! – David H Oct 06 '21 at 15:07
  • 4
    The "second icon" Larme is referring to is the one with the five horizontal lines. – P. Stern Oct 18 '21 at 18:28
  • 2
    You can bring up the option to discard a code change by tapping the blue bar in the gutter to the left of the change. – P. Stern Oct 18 '21 at 19:07
  • 1
    @P.Stern Didn't find that :( – Tony Oct 21 '21 at 13:42
  • @Tony - If you are referring to the button with five horizontal lines, it doesn't appear until after you click on the button with right and left arrows. If you are referring to the blue bar, it appears to the left of the line number when you change a line of code. If you select the blue bar, a menu comes up with the option to "Discard Change". – P. Stern Oct 22 '21 at 15:46
  • @P.Stern I can't find the blue bar!!! It used to exist in all previous Xcode versions but not in Xcode 13.0 – Tony Oct 25 '21 at 10:52
  • 2
    @P.Stern I found it now. It only appears when I have non-committed local changes. It used to appear even comparing comitted changes to older commits. Thank you anyway. – Tony Oct 26 '21 at 03:09
  • The last sentence was essential for me. I had spotted the code review option on top, but having multiple editors side by side, I was struggling to find the list of commits/branches to compare with, which is at the bottom of the screen below all editors. – lbarbosa Nov 19 '21 at 11:11
4

You can enable it quickly in the menu Editor > Side By Side Comparison.

Editor > Side By Side Comparison

Marián Černý
  • 15,096
  • 4
  • 70
  • 83