Viewing Difference Between Files from Command Line
You can use IntelliJ IDEA as a command line tool for viewing differences between files.
- In the command line, run the
diff
command using the following syntax:<IntelliJ IDEA> diff path1 path2
The selected files will be opened in the Differences Viewer for Files.
The command options are as follows:
Option | Description |
---|---|
<IntelliJ IDEA> | The platform-dependent IntelliJ IDEA launcher. On macOS and Linux, it is recommended to use the command line launcher created during the IntelliJ IDEA installation, or create one manually by selecting on the IntelliJ IDEA main menu. Refer to Working with IntelliJ IDEA Features from Command Line for details. |
path1 | The full path to the local copy of the file. |
path2 | The full path to the repository version copy of the file. |
Examples
- Syntax
-
<IDE_HOME>\bin\idea.exe diff path1 path2
- Example
-
<IDE_HOME>\bin\idea.exe diff C:\MyProject\Readme.md C:\MyProject\Readme.md.bak
- Syntax
-
IntelliJ\ IDEA.app/Contents/MacOS/idea diff path1 path2
- Example
-
IntelliJ\ IDEA.app/Contents/MacOS/idea diff ~/MyProject/Readme.md ~/MyProject/Readme.md.bak
- Syntax
-
<IDE_HOME>/bin/idea.sh diff path1 path2
- Example
-
<IDE_HOME>/bin/idea.sh diff ~/MyProject/Readme.md ~/MyProject/Readme.md.bak
Last modified: 4 April 2018