I haven't checked NetBeans for that, but the Eclipse
IDE has a "compare with" feature that allows comparing and merging 2 files within an Eclipse workspace. I've used it fairly often, since I have several projects that each are forced to keep their own copies of a file that (ideally) is identical in all of them.
The Linux (and other Unix/Unix-like) OS has a rich set of text comparison utilities, starting with the grandaddy of them all - the "diff" utility. You can find Windows implementations of diff, although they're not part of the standard OS distribution like in *n*x systems. I've used the Emacs text editor's compare/merge utilities quite a bit.
However, once you have reached the point where you have different versions of the same program to keep under control, I agree with previous posters. Use a Version Control System. The two most popular VCS's at the moment are git and Subversion (svn), but there are many others as well, both free and commercial.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.