A + prefix indicates that the associated line exists in the
new file but not in the original. A ??“ sign indicates that a line exists in the original file but
not in the new file. Lines with no prefix serve to show surrounding context information
so that patch can more precisely locate the lines to be changed.
patch patch is a tool that is capable of understanding the output of diff and using it
to transform a file according to the differences reported by diff. Patch files are most
often published by software developers as a way to quickly disseminate just that information
that has changed between software revisions. This saves time because downloading
a patch file is typically much faster than downloading the entire source code for
an application. By applying a patch file to original source code, users transform their
original source into the revised source developed by the program maintainers. If we had
the original version of example.c used previously, given the output of diff shown earlier
and placed in a file named example.patch, we could use patch as follows:
patch example.c < example.patch
to transform the contents of example.c into those of example_fixed.c without ever seeing
the complete file example_fixed.
Pages:
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851