问题
How can I compare a document in current project with one that is not a part of project? How can I compare two arbitrary files in my computer with phpStorm?
回答1:
Currently, the easiest way that I found for comparing a project file with a non-project file is coping the external file to clipboard and clicking on "View->Compare with clipboard".
回答2:
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.
回答3:
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"
回答4:
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.
来源:https://stackoverflow.com/questions/12365086/diff-in-phpstorm