Creating patches with diff
Using diff is simple when you are working with single files. To create a patch for a single .
diff -u file1.txt new.txt > new_file.patch
For the directory, use following command:
diff -rupN directory1/ directory2/ > dir.patch
Apply patch
To apply a patch to a single file, change to the directory where the file is located and call patch:
Using diff is simple when you are working with single files. To create a patch for a single .
diff -u file1.txt new.txt > new_file.patch
For the directory, use following command:
diff -rupN directory1/ directory2/ > dir.patch
Apply patch
To apply a patch to a single file, change to the directory where the file is located and call patch:
patch < dir.patch
you can specify the file on the command line:
patch file.txt < dir.patch
To remove a patch, use the -R flag,
patch -R file.txt < file.patch