The output of similar file comparison utilities is also called a "diff"; like the use of the word "grep" for describing the act of searching, the word diff became a generic term for calculating data difference and the results thereof.
[2] The POSIX standard specifies the behavior of the "diff" and "patch" utilities and their file formats.
[3] diff was developed in the early 1970s on the Unix operating system, which was emerging from Bell Labs in Murray Hill, New Jersey.
It was part of the 5th Edition of Unix released in 1974,[4] and was written by Douglas McIlroy, and James Hunt.
This research was published in a 1976 paper co-written with James W. Hunt, who developed an initial prototype of diff.
Proof also originated on Unix and, like diff, produced line-by-line changes and even used angle-brackets (">" and "<") for presenting line insertions and deletions in the program's output.
His approach to the problem resulted from collaboration with individuals at Bell Labs including Alfred Aho, Elliot Pinson, Jeffrey Ullman, and Harold S. Stone.
In the context of Unix, the use of the ed line editor provided diff with the natural ability to create machine-usable "edit scripts".
In 1984, Larry Wall created a separate utility, patch, releasing its source code on the mod.sources and net.sources newsgroups.
[6][7][8] This program modifies files using output from diff and has the ability to match context.
[9] In diff's early years, common uses included comparing changes in the source of software code and markup for technical documents, verifying program debugging output, comparing filesystem listings and analyzing computer assembly code.
The output targeted for ed was motivated to provide compression for a sequence of modifications made to a file.
[citation needed] The Source Code Control System (SCCS) and its ability to archive revisions emerged in the late 1970s as a consequence of storing edit scripts from diff.
The context format of diff introduced at Berkeley helped with distributing patches for source code that may have been changed minimally.
At the beginning of the patch is the file information, including the full path and a time stamp delimited by a tab character.
Unified context diffs were originally developed by Wayne Davison in August 1990 (in unidiff which appeared in Volume 14 of comp.sources.misc).
In many versions of GNU diff, each range can omit the comma and trailing value s, in which case s defaults to 1.
Note that to successfully separate the file names from the timestamps, the delimiter between them is a tab character.
For example, some revision control systems—such as Subversion—specify a version number, "working copy", or any other comment instead of or in addition to a timestamp in the diff's header section.
Neither the unidiff utility nor the POSIX diff standard define a way to handle this type of files.
[15]) GNU diff and git produce "\ No newline at end of file" (or a translated version) as a diagnostic, but this behavior is not portable.
[18] Changes since 1975 include improvements to the core algorithm, the addition of useful features to the command, and the design of new output formats.
[22] Postprocessors sdiff and diffmk render side-by-side diff listings and applied change marks to printed documents, respectively.
It was originally conceived by Paul Jensen to reconcile changes made by two people editing a common source.
[24] While historically invoking the diff program, modern vim uses git's fork of xdiff library (LibXDiff) code, providing improved speed and functionality.
[25] GNU Wdiff[26] is a front end to diff that shows the words or phrases that changed in a text document of written language even in the presence of word-wrapping or different column widths.
[34][35] In addition, free tools that perform syntax-aware diff include: spiff is a variant of diff that ignores differences in floating point calculations with roundoff errors and whitespace, both of which are generally irrelevant to source code comparison.
An improved Myers algorithm with Rabin fingerprint was originally implemented (as of the final release of 2008),[46] but git and libgit2's fork has since expanded the repository with many of its own.