The following fragment will compar directories foo.orig and foo and place the differencies foo.patch.

Us this as follows:
Copy the directory foo to foo.orig
Do necessary changes in fo
Run the following command and you will have all the changes in foo.patch
diff -Naur foo.orig foo > foo.patch
Suppose you have foo.orig and foo.patch directories.
Then copy foo.orig into foo
chdir into foo
Run the following comand and you will have foo.orig with all recorded changes.
patch -Np1 -i ../foo.patch
Copyright (C) 2006 Andrey Mirzoyan