Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a lightweight way to notate changes made to a file. The obvious answer to this is a version control system. But this is more robust than necessary for what I would like to do. All I want is the functionality to compare an edited file to its original in a lightweight manner.

share|improve this question
well to me a way to notate changes made to a file, if (as you further specified it in comments to another answer) it is also plug-able into larger software systems reads version control anyway – gnat Dec 14 '11 at 6:34
It's quite possible that there is no real alternative. Essentially, I'm looking for the functionality of comparing a file and comparing what would be 'forks' of that file. – DanLeaningphp Dec 14 '11 at 6:41
Perhaps a bit obvious, but why wouldn't diff do what you need? – Tim Post Dec 14 '11 at 6:41
Could you clarify what you are looking for? Functionality for comparing "an edited file to its original" is available in many text editors. But, you must somehow get the original file first, and that is what version control is all about. – sleske Dec 14 '11 at 9:26
up vote 5 down vote accepted

You might want to check the set of tools diff, cmp, sdiff, diff3, etc. These will provide you with easy to parse text output, making them usable from another program. diff in particular would probably do what you want.

share|improve this answer

For a complete list of text/source editors that produce "Diffs" see:

I would suggest using Meld if you are on Linux, and Netbeans if you aren't. Both compare files in a graphical way. Netbeans does Realtime-Data-Protection... If you are interested in that... (It keeps track of all of your file-changes and allows you to compare any two versions for the last N* days)

share|improve this answer

I just use notepad++. It has an on-the-fly style diff feature -- no versioning system required, and software is very lightweight.

share|improve this answer
If you want to check it out open N++ and open two "views" - on the left your old version and on the right the new one. Then go to Plugins -> Compare -> Compare. – JSideris Dec 14 '11 at 5:24
To be clear I'm looking for solutions that are plug-able into larger software systems. – DanLeaningphp Dec 14 '11 at 5:36
Ah. Cvs is my choice for larger projects, but if you don't want a version control then I'm not too sure what else to suggest. – JSideris Dec 14 '11 at 5:48
Is it more "lightweight" than just a plain diff tool? I guess not. – SK-logic Dec 14 '11 at 8:02

Are you after a code review tool. Give you use GIT, have a look at Gerrit. Even if you don't want code review, it may provide what you are seeking.

share|improve this answer

diff is the answer to your explicit question. But there's an implicit question as well. You appear to think version control is heavyweight. Some VCSes are indeed painful enough to get set up or deal with ongoing that there's a minimum threshold to get started with them. Mercurial, however, works very easily and very nicely in a lightweight, no-server-needed, mode.

share|improve this answer
+1 for Mercurial – codesparkle Dec 23 '11 at 13:01
fair enough. heavy vs. lightweight wasn't so much my concern as functionality needed vs. not needed. – DanLeaningphp Dec 23 '11 at 15:28

Many text editors have this functionality built-in. Emacs is one example. If you set

(setq version-control t)

it will keep numbered backup files around. For a file named foo, Emacs will then create foo.i for integers i. By default, Emacs will keep the two oldest and two newest versions around, but this can of course be configured, just like everything else in Emacs can be configured :-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.