You can use the change bar, that appears in the gutter of the source editor, to view changes, discard changes, and find out who made conflicting changes. First, enable the change bar and optionally, include upstream changes in preferences.
The style and color of the bars indicate the type of changes:
Color and style | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Solid blue | Uncommitted local changes | ||||||||||
Solid gray | Committed (but not pushed) local changes | ||||||||||
Outline blue | Upstream changes | ||||||||||
Solid red | Upstream and local changes conflict |
Choose Xcode > Preferences, then click Source Control.
Under General, in the Text Editing section, click “Show Source Control changes.”
If you make changes to your file, a change bar now appears in the gutter of the source editor.
To show changes committed by others, click “Include upstream changes.”
Hover the pointer over the change bar.
The range of characters that changed are highlighted.
Click the change bar next to the edits you want to discard.
In the dialog that appears, click Discard Change.
If you include upstream changes when you enable the change bar, the change bar will turn red if your local changes conflict with another person’s upstream changes.
Hover the pointer over the red change bar.
The range of characters that are in conflict are highlighted.
Click the red change bar, then choose an action from the dialog that appears.
The action dialog shows a summary of the other person’s commit.
If you choose Discard Change, choose Source Control > Pull to pull the other person’s changes.
Click the change bar next to the edits you want to view.
Choose Show Commit from the Action menu.
The comparison editor shows the commit in the editor area.