

For example, if you're using Git, you can go to VCS → Git or right click your editor and select Git. If you're using a Version Control System, you have several more comparison options. Here you can browse older versions of your current file and see the difference between the old and the current version and apply any changes if required. You can right-click in your editor and select Local history → Show history. Comparing with the previous local version of the fileĮven if you're not using any Version Control system, IDEA stores historical versions of your local files. This opens a brand new diff window with both panels blank, so you can copy and paste both snippets to be compared.
COMPARE FOLDERS CODE
What about the case when you want to compare two non-file code snippets from external sources? You can do this too! Just run Find Action via Ctrl + Shift + A and then search for Open Blank Diff Window. If you want just a selection instead, select some fragment of the file first and then right-click as before.

If you want the whole file to be compared, just right-click anywhere in the editor and select Compare with Clipboard from the context menu. Either compare the whole file against the clipboard or just a selection. Then copy to clipboard the snipped you want to compare ( Ctrl+ C). Maybe it is a code snippet from the web, for example, from stack overflow.įirst, you need to open the file from your project in your editor. Maybe you have a file in your project, and you need to compare it with some external content, which is not saved as a file on your machine. Now the comparison is the same as in the example above. The last step is to browse for an external file to compare with.

This comparison works for images, too, although you cannot see and apply individual differences. You can click the arrow icons » and « to apply a particular change from one file to another.
