First generate a patch for others to apply.
For this we use diff
where the first argument shall be the original file or directory where did you started making the modifications and the second should be a version of the file or directory with the modifications already made.:
diff -Naur old_file new_file > your_patch_filename.patch
or (if applied against directories):
diff -Naur old_dir new_dir > your_patch_filename.patch
The options on these diff commands are the following
-N --new-file
- Treat absent files as empty.
-a --text
Treat all files as text.
-u -U NUM --unified[=NUM]
Output NUM (default 3) lines of unified context.
-r --recursive
Recursively compare any subdirectories found.
Finally, to apply these patches you use the patch
tool:
patch -p0 < patch_filename.patch
Note: This should be applied on the same relative directory where diff
was executed. If you don't know which one it is you can check the patch file with any editor and try to figure that out.