Reputation: 18010
How can I compare a document in the current project with one that is not part of the project? How can I compare two arbitrary files on my computer with phpStorm?
Upvotes: 15
Views: 11831
Reputation: 18010
Currently, the easiest way that I found to compare a project file with a non-project file is by copying the external file to the clipboard and clicking on "View-> Compare with clipboard".
Upvotes: 32
Reputation: 839
Create a file in /usr/local/bin/
named PhpStorm
Paste this
#!/bin/sh
open -na "PhpStorm.app" --args "$@"
And make it executable
chmod +x /usr/local/bin/PhpStorm
And now you can do this
PhpStorm diff <path1> <path2>
Add PhpStorm bin to your PATH
setx PATH=%PATH%;C:\Program Files\JetBrains\PhpStorm\bin
Now you can do this
phpstorm.bat diff <path1> <path2>
Create a link to your PhpStorm launcher script :
# Path to PhpStorm installation may differ
ln -s /opt/phpstorm/bin/phpstorm.sh /usr/local/bin/phpstorm
Now you can do
phpstorm diff <path1> <path2>
Sources from jetbrains werbsite :
https://www.jetbrains.com/help/phpstorm/command-line-differences-viewer.html
https://www.jetbrains.com/help/phpstorm/working-with-the-ide-features-from-command-line.html
Upvotes: 3
Reputation: 1213
What I do for comparing two external sources (web page sources etc.)
1 - Open a new scratch file from "File" Menu -> "New Scratch File" and choose a file type
2 - Copy & Paste Source 1 to this new scratch file
3 - Either create a new scratch file for second source and click "Compare With" from "View" Menu or better just directly copy second to clipboard and from "View" Menu click to "Compare with Clipboard"
Upvotes: 2
Reputation: 1415
In phpStorm 2016.2 (and possibly some earlier editions) you can navigate to the external file via File >> Open... , which will open a tab showing the external file's content. You can then use View>> Compare with... to compare the external file to a file within your project.
Upvotes: 0
Reputation: 401897
It can be done only externally:
You can also open the difference viewer without running PhpStorm. This is done through the following command:
<path to PhpStorm executable file> diff <path_1> <path_2>
where path_1
and path_2
are paths to the files in question, which can be of various types, including jar.
From inside PhpStorm you can only compare files that are available in the project.
Upvotes: 8