Difference between revisions of "Diff and patch"
From Noah.org
Jump to navigationJump to searchLine 1: | Line 1: | ||
− | |||
If you don't have svn access to a project and want to submit a | If you don't have svn access to a project and want to submit a | ||
manual patch, the following notes should help. | manual patch, the following notes should help. | ||
Line 9: | Line 8: | ||
<pre> | <pre> | ||
− | diff -r -c -x".svn" -x"*.jpg" -x"*.a" -x"*.so" -x"*.o" -x"*.pyc" -x"CVS" | + | diff -r -c -x".svn" -x"*.jpg" -x"*.a" -x"*.so" -x"*.o" -x"*.pyc" -x"CVS" \ |
+ | "/home/user/project-ORIGINAL" "/home/user/project-NEWER" > changes.patch | ||
</pre> | </pre> | ||
Revision as of 11:50, 29 May 2007
If you don't have svn access to a project and want to submit a manual patch, the following notes should help. You made changes to many files in a project and you want to submit a patch to the maintainer of the project. First, find out if they want Context or Unified diffs. That will set the -c or -u option for diff. I usually go with -c when in doubt.
diff -r -c -x".svn" -x"*.jpg" -x"*.a" -x"*.so" -x"*.o" -x"*.pyc" -x"CVS" \ "/home/user/project-ORIGINAL" "/home/user/project-NEWER" > changes.patch
This will generate a patch file that you can mail to the project maintainer. They will then apply the patch as follows:
cd project-ORIGINAL patch < changes.patch
You can add many more -x options to exclude patterns of files that you do not want included in the patch.