Language:

Creating patches


Using GNU Diff
1. Download and install GNU Diff.
2. Type cmd in Run and navigate your way to where GNU Diff is installed.
3. Write diff -[parameter(s)] <path to the untouched file or folder> <path to the changed file or folder> > my-diff.diff
4. A file, my-diff.diff, will now be created in the directory which GNU Diff is placed. Other extensions for the patch (such as .txt) are acceptable, there is no standard.

Example: C:\Program Files\GNU Diff>diff -uNr dcplusplus_orig dcplusplus_chan > my-diff.diff
C:\Program Files\GNU Diff is where GNU Diff is installed.
The parameter u means the diff will be unified. N means that GNU Diff will show output even if a file doesn't exist in one of the two folders. r means that GNU Diff will go through subdirectories and give output on which directory and file differ.
dcplusplus_orig is the folder that is untouched and what the changes is going to differ against.
dcplusplus_chan is the folder where changes has occured.
The actual diff is my-diff.diff.

Parameters and more information on how to use GNU Diff can be found in the documentation for GNU Diff which should have come included with GNU Diff. Otherwise, the manual can be found at the GNU Diff manual

Interpreting the diff
diff -uNr dcplusplus_orig/client/file.cpp dcplusplus_chan/client/file.cpp
--- dcplusplus_orig/client/file.cpp Tue Nov 30 00:21:30 2004
+++ dcplusplus_chan/client/file.cpp Wed Dec 1 13:59:59 2004
@@ -336,7 +336,7 @@
// text
// text
int a = 0;
- int b;
+ int c;
double pi;
string helpfile;
string dcplusplus;
Lines starting with - (minus sign) are going to be removed.
Lines starting with + (plus sign) are going to be added.