views:

76

answers:

4

I'm looking for an easy-to-use, free source code comparison app for Windows, which will highlight differences side-by-side between two pieces of source code. Some apps get close to what I want, but are too restrictive by requiring you load in entire files and compare them in their entirety. Sometimes I just want to compare a section of my file, such as a single function, which may be in totally different locations in the two versions I'd be comparing, making it hard to find in both panes in large files. Basically, I'd like to be able to simply edit/copy/paste the content in both panes rather than have the restriction of using files. That way I can copy and paste one function into one pane and another into the other, editing/re-ordering as necessary.

(Note that I realize there are other comparison app recommendation threads out there, but I'm having a hard time finding a free app that isn't a strict file-to-file comparison app)

Thanks for any pointers or links, thanks!

+3  A: 

I do this in Vim all the time. Here's what I do:

  1. Run gvimdiff -O a b. This is Vim is GUI diff mode.
  2. Paste "before" into left pane of Vim.
  3. Paste "after" into right pane of Vim.
  4. :diffupdate (not always necessary)

You can also edit either side of the diff, which can be handy.

I imagine that any text editor that supports side-by-side diff and copy and paste should be able to do something similar.

And before you object that Vim is file-based (which is true), the above procedure doesn't require creating any actual files in the file-system.

Laurence Gonsalves
A: 

Notepad++ has a nice diff function that will suit your needs also.

Jeremy Morgan
A: 

Winmerge can be used to do what you outlined (i.e., edit/copy/paste snippets into two windows and then make comparisons or mergers).

bi0m3trics
A: 

Compare++ just meets your needs. The diff tool is a visual specialized tool for file comparison, merging and folder synchronization. With it, you can compare and align two functions.

What you can do with Compare++

  • Compare sub-sections of files such as code structures;
  • Compare files and folders with lightning speed;
  • List all code structures change such as function changes
  • One step to merge multiple differences from side to side
  • Compare the containing folder for loaded files
  • Support "Edit files and instantly compare"
  • Automatically detect files and folders changes outside