- or download this
$ tree -f -a .
.
|-- ./Foo
...
`-- ./Foo-old/one.txt
3 directories, 4 files
- or download this
$ cat Foo-new.patch
diff -Npurd Foo-old/one.txt Foo-new/one.txt
...
@@ -0,0 +1 @@
+new file
- or download this
$ cd Foo
...
patching file one.txt
patching file two.txt
- or download this
$ patch -p0 -i../Foo-new.patch
can't find file to patch at input line 4
...
1 directory, 2 files
- or download this
diff -Npurd emptyDir tmpFoo > tmpFoo.patch
- or download this
diff -Npurd emptyDir/Foo/one.txt tmpFoo/Foo/one.txt
--- emptyDir/Foo/one.txt 1969-12-31 16:00:00.000000000 -0800
+++ tmpFoo/Foo/one.txt 2012-08-16 08:21:35.609375000 -0700
...
@@ -0,0 +1 @@
+hi there
- or download this
$ cd tmp2Foo
...
`-- ./two.txt.rej
0 directories, 4 files
- or download this
$ patch -p1 -i ../tmpFoo.patch
patching file Foo/one.txt
...
`-- ./Foo-old/one.txt
3 directories, 4 files
- or download this
$ patch -p0 -i ../tmpFoo.patch
patching file tmpFoo/Foo/one.txt
...
`-- ./tmpFoo/Foo-old/one.txt
7 directories, 8 files
- or download this
$ patch -p0 -R -i ../tmpFoo.patch
patching file tmpFoo/Foo/one.txt
...
`-- ./Foo-old/one.txt
3 directories, 4 files