Let’s say you’re working on a series of Web sites that share similar style sheets but there are slight differences between them and you want to consolidate them into one style sheet. Yeah…
Instead of going line by line or using various Find and Replace methods check out a little know utility that comes as part of Apple’s Developer Tools, called Xcode, in Mac OS X.
It’s called FileMerge and its mission is to compare two files and then merge the differences into one. However, I never trust tools that do such things, so I simply used its amazing file comparison features to make sure I was doing the right things to the right files.
When you launch FileMerge, you’re prompted for the locations of two files which then open in one window with a vertical divider down the middle.
FileMerge highlights the sections that differ in each file, and uses an arrow in the center area to show whether the higlighted item needs to be added to the right or left file in order to make them identical. I used FileMerge to open two style sheets and compare them. I would then copy and paste and make the actual edits in TextMate or Dreamweaver. The visual cues provided by FileMerge were invaluable in helping me understand what I’d done to the code and without its help, I probably still be working on it!
I’m sure there are other tools out there that do the same thing (and perhaps even better, and I could trust the merge function), including UNIX’s diff command. But FileMerge was there, the smooth-scrolling auto-lineup feature has to be seen to be understood (it’s very cool), and it was free …
I became addicted to Apple’s FileMerge tool … even though I never used it for its full intended purpose!