IntelliJ IDEA Tips & Tricks: 1. Comparing Files and Folders

From the translator : Wojtech Ruzicki's blog on programming has 13 posts with the IDEA tag . One of them was translated and published on Habré - Best IntelliJ IDEA plugins . It turned out to be quite popular and I decided to try and translate other posts about IDEA. Hope to be helpful for you.

IntelliJ IDEA offers many ways to compare files, folders, and code snippets, and even synchronize folder contents.


Comparing Project Files


Suppose your project has two similar files, and you need to compare them line by line. With IDEA, it is very simple. Just select both files in your project window (holding Ctrl for multiple selection).


You now have two options:


  1. Right-click one of the files and select “ Compare Filesfrom the menu .
  2. Press Ctrl + D

After that, a new window opens, which contains two panels, each of which displays the contents of one file. This is very similar to diff in version control systems such as Git.



Each difference has a color coding:


  • Lack of coloring means that the content is the same
  • Blue means there are changes in the same line
  • Green means new content
  • Gray means deleted content

» «, .


C , .



, .


. :


  1. «Compare With...»
  2. Ctrl + D

— . , .



, , , . , , , stackoverflow.


-, . , (Ctrl + C).


. , .


  1. , , «Compare with Clipboard» .
  2. , - , , .


, ? ! Find Action Ctrl + Shift + A Open Blank Diff Window .


, .



- , IDEA . Local history → Show history .



, .


VCS


(VCS), . , Git, VCS → Git Git. :


  • :
  • :
  • :


, . , — Ctrl + D Compare Directories .



, . , , . , .



, . , . , , . *. , Synchronize selected, Synchronize all .



All Articles