Book Image

IntelliJ IDEA Essentials

By : Jaroslaw Krochmalski
Book Image

IntelliJ IDEA Essentials

By: Jaroslaw Krochmalski

Overview of this book

Table of Contents (17 chapters)
IntelliJ IDEA Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Comparing files and folders


When you develop a project, often there is a need to compare the contents of the files or the structures of the folders. Usually, you would have to use an external tool for that, and there are plenty of such tools in the market. IntelliJ IDEA provides its own file diff and folder synchronization features. Let's start with comparing files.

Comparing files

To compare two files, select them keeping the Ctrl key pressed in the project structure tree and choose Compare Two Files from the context menu; or press Ctrl + D (PC) or cmd + D (Mac). The differences viewer will open with the differences highlighted:

You can move between code differences using the arrows in the differences viewer toolbar or by pressing the keyboard shortcuts; F7 will jump to the next difference and Shift + F7 to the previous one.

To synchronize two files, use the "Replace" arrow buttons in the middle of the editor. To move the change from the left file to the right one, press the >> icon....