rcsdiff -r1.5 -r1.6 -wu p-ml-apics.tex
rcsdiff -r1.5 -r1.6 -wu p-ml-apics.tex
diff -UbBwd
-b Ignore changes in amount of white space. -B Ignore changes that just insert or delete blank lines. -d Change the algorithm to perhaps find a smaller set of changes. This makes diff slower (sometimes much slower). -U Use the unified output format. -w Ignore white space when comparing lines.
documented on: 2007-09-22
SYNOPSIS
diff3 [options] mine older yours
Options
-E Generate an ed script that incorporates all the changes from older to yours into mine, except bracket lines from overlapping changes' first and third files. With -e, an overlapping change looks like this:
<<<<<<< mine lines from mine ======= lines from yours >>>>>>> yours
-m --merge Apply the edit script to the first file and send the result to standard output. Unlike piping the output from diff3 to ed, this works even for binary files and incomplete lines. -A is assumed if no edit script option is specified.
-A Incorporate all changes from older to yours into mine, surround- ing all conflicts with bracket lines.
-T Output a tab rather than two spaces before the text of a line in normal format. This causes the alignment of tabs in the line to look normal.
--initial-tab Output a tab rather than two spaces before the text of a line in normal format. This causes the alignment of tabs in the line to look normal.
-i Generate w and q commands at the end of the ed script for System V compatibility. This option must be combined with one of the -AeExX3 options, and may not be combined with -m.
diff3 many-changed-file original-file less-changed-file
diff3 -E many-changed-file original-file less-changed-file > script
edit the script a little bit most important, delete the last 2 line of
w q
Otherwise, the original file will be overwritten!!!
# backup is always recommended! cp many-changed-file{,.sav} cp many-changed-file file-to-change
(cat script; echo '1,$p') | ed - file-to-change > file-changed diff -C 2 file-to-change file-changed
edit the newfile according to the diff and what we want
patch --backup longlines.el patchfile
diff -Naur old new
patch - apply a diff file to an original
SYNOPSIS
patch [options] [originalfile [patchfile]] but usually just patch -pnum <patchfile
Options
-a Treat all files as text and compare them line-by-line, even if they do not seem to be text.
-u Use the unified output format.
-r When comparing directories, recursively compare any subdirec- tories found.
-N --new-file In directory comparison, if a file is found in only one direc- tory, treat it as present but empty in the other directory.
Sample:
patch takes a patch file patchfile containing a difference listing produced by the diff program and applies those differences to one or more original files, producing patched versions.
Normally the patched versions are put in place of the originals. Backups can be made; see the -b or —backup option.
The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can specified on the command line as original- file.
Upon startup, patch attempts to determine the type of the diff listing, unless overruled
patch tries to skip any leading garbage, apply the diff, and then skip any trailing garbage. Thus you could feed an article or message containing a diff listing to patch, and it should work.
With context diffs, and to a lesser extent with normal diffs, patch can detect when the line numbers mentioned in the patch are incorrect, and attempts to find the correct place to apply each hunk of the patch.
If patch cannot find a place to install that hunk of the patch, it puts the hunk out to a reject file, which normally is the name of the output file plus a .rej suffix
If the patch file contains more than one patch, patch tries to apply each of them as if they came from separate patch files.
Create your patch systematically. A good method is the command
diff -Naur old new
For proper operation, patch typically needs at least two lines of context.