In an earlier post on creating child themes for WordPress, I said that if you had already made changes to your theme, you could use a program like WinMerge to find the differences between a clean copy of your theme and the copy you’ve been editing.
The time has come to show just how that is accomplished.
Your first step is to go to the WinMerge site, download WinMerge, and install it.
Next, you’ll need two files to compare. For our example, I used the 3.1.1 and the trunk tags of the Akismet plugin for WordPress. (I was trying to learn how to use Subversion at the time, and went to a plugin I knew was done properly to see how they set things up. Seeing how others do something and then doing likewise is a great way to learn things.)
Once you open WinMerge, go to File >> New, and go to File >> Open to bring up a dialogue box to select your two files:
Select one file for “Left:”, another file for “Right:” and then click okay. You’ll see something like this:
There is only a single difference between these two files. The location pane is showing us where that difference is:
The two file panes show us that difference in each file. In this case, the 3.1.1 tag file is missing something:
that the trunk tag file contains:
It’s that simple, although if you have a file that you have made a lot of changes to, you will see a lot more red and pink than this example.
Other Super Powers
Not only can WinMerge show you the difference between two files, it can also merge those two files together. It can also show the differences between two folders, which is very handy. Interested? View the one-page tour, or read the manual. I’ve found all sorts of uses for WinMerge, and I’m sure you will too.