Compare base and working files using the Diff tool
The Code Editor includes an integrated Diff tool, which allows you to compare the read-only base copy and working copy of a file.
Specify how the differences are displayed by using these options from the Diff menu:
- Normal View
- Opens the file in normal editing mode.
- Diff View
- Displays differences between the base file and working copy in a single pane document. This is also called single pane diff mode. Added and modified lines are highlighted. Deleted lines are identified by location but not displayed.
- Diff View with Deleted Blocks
- Displays differences between the base file and working copy in a single pane document. Added, modified, and deleted lines are highlighted.
- Vertical Dual Diff View
- Displays the two files vertically, with the base file in the left pane and the working copy in the right pane. This is also called two pane diff mode.
- Horizontal Dual Diff View
- Displays the two files horizontally, with the base file in the top pane and the working copy in the bottom pane. This is also called two pane diff mode.
Example: Diff View
This figure shows Diff View. Lines 28-32 are marked with green blocks to indicate newly added lines. The orange block in the gutter of line 24 indicates a modified line (a new comment, highlighted in green, has been added to the existing line). The red line between line 22 and line 23 flag the location of a deleted line/lines.
Example: Vertical Dual Diff View
This figure shows Vertical Dual Diff View. Side-by-side comparison of the base file in the left pane and the editable working copy in the right pane give you a before and after record of changes. Red blocks in the gutter of the base file pane show the contents of lines deleted in the working copy.
Viewing differences between files
The Diff tool flags differences between files with color-coded markups in the Code Editor gutter. The default colors are:
- Green - added lines
- Orange - modified lines
- Red - deleted lines
Locate differences between the files by using the navigation options from the Diff menu: First Difference, Previous Difference, Next Difference, and Last Difference.
To specify display options for the Diff tool, select , then (or, if you are on a Mac, ) . See Diff tool preferences for further details.
Selecting the base file
- Use Generated File
- The default for generated files, this option compares the document with the file generated by the application generator. This is the generated file before POINTs and BLOCKs are injected into the file. This option is made available only if the file has been generated.
- Use Repository File
- The default for versioned files, this option compares the document with the file in the repository for the current SVN version of the file. This option is enabled only if the file is versioned.
- Use File on Disk
- Compares the document with the contents of the file as it was on disk when the file was opened. If you select this option again after the file has been opened, the diff data will be refreshed by comparing the document with the actual content of the file on disk.
To change the base file, select
.Reverting changes in the working file
You can replace any changes in the working copy with the original values from the base copy. Place the cursor in the line of marked code that you want to revert and select
. To revert all changes, select .