Diff: creating patch for directory which adds new files
Posted: Fri Jul 15, 2011 2:33 pm
[PROBLEM]
I've improved an existing Free Software application and wanted to save my changes in a default .patch format.
No big deal, but unfortunately, I did not only edit previously existing files, but also added new ones.
So, calling diff with "-c" (context) and "-r" recursive, only created patch information for files that exist in both versions:
[SOLUTION]
If you add the "-N" option to "diff", it will treat non-existent files as empty. That's exactly what we want:
Just add the "N" as diff option - the rest of the command stays the same
I've improved an existing Free Software application and wanted to save my changes in a default .patch format.
No big deal, but unfortunately, I did not only edit previously existing files, but also added new ones.
So, calling diff with "-c" (context) and "-r" recursive, only created patch information for files that exist in both versions:
Code: Select all
diff -cr original_version_folder/ my_modified_version_folder/ > tool-1.0.0_to_1.0.1.patch
If you add the "-N" option to "diff", it will treat non-existent files as empty. That's exactly what we want:
Code: Select all
diff -Ncr original_version_folder/ my_modified_version_folder/ > tool-1.0.0_to_1.0.1.patch