how do i create a standard patch using diff -u without using a different name for the “new” file?
when i submitted a patch for an Apache project, the committer advised that i don’t need to rename the file when submitting patches. i can somewhat understand how this breaks patching since the name of the “new” file should somehow match the name of the patch target – however they can’t be in the same directory with the same name.
is it okay (for ease of patching) to rename the “old” file, such that i should have used:
diff -u Source-old.java Source.java
instead of:
diff -u Source.java Source-new.java
?
Given an existing project ‘a’, copy whole project to ‘b’, make changes in ‘b’. Generate diff between original directory and your copied directory.
E.g., checkout or download project to directory ‘a’, copy to ‘b’:
Make changes to ‘b’ (and only ‘b’):
Another alternative is to store the original source in a temporary, local git repository, then use git’s built-in
diffto generate the patch. Or, better, if the original source is using git, then just clone the repo and work directly in the source tree itself, and (still) using git to generate the patch.