In this section, you will learn how to compare files or folders to check the structure/code differences. This operation may be useful in many cases. One would be when you want to check the code modifications between different versions of the theme. To compare theme files, we will use Winmerge, a free tool. You can check its documentation here.
We won’t cover this area here; it is explained in detail in the software documentation – here.
You can access the settings area from the menu Edit -> Options. The most important settings are located in the Compare tab, from here you can specify how the compare process works. Depending on what you want to compare, you can set it to ignore certain aspects (ex. white space, blank lines or carriage return differences) if you don’t consider them essential and you want to return only the result on which you’re interested. The settings used by us are presented below, but you should play with the settings until you obtain the results you’re looking for. The Compare -> Folder settings were not modified.
In the following example, I will compare the Newspaper theme folders for version 9.2 and 9.2.1. To do this, open Winmerge, and click on the File -> Open… menu. You can also use the shortcut CTRL+O. This will open a new window, and you have to choose the directories or files that you want to compare. In my case, I’ve selected the folders for Newspaper version 6.5 and 6.5.1. The other filters were set to compare all files and include subfolders.
Once you’re done, click the Compare button and wait for the compare process to be complete.
If you double click on a file, you can see the differences between them as highlighted. In the following image you can see the style.css file on which only the version was changed from 9.2 to 9.2.1, and on the left, you can find the Location panel where you can see the position of the lines which are changed from one version to the other.
As the title says, this software comes with options to merge the compared files, you can find them in the Merge menu. We will not discuss them in this tutorial, but you can read about them in the official documentation – here.