How to make a "diff" command including an empty file when creating a patch file

The Linux-system assume that there are 2 folders and one empty file fld1

, fld1/__init__.py

and fld2

(here __init__.py

- an empty file created by "touch" command).

Then I create a patch file with the command diff -urNp fld1 fld2 > tmp.patch

. No differences were found in tmp.patch

.

If I remove the "-N" option and only use it diff -urp fld1 fld2 > tmp.patch

, it can tell the difference, but it only shows: "Only in fld1: __init__.py" which is not the correct patch format.

To work around this problem, I add one new line in __init__.py

as a workaround. then "-urNp" works as expected.

But I still want to know: how can I use "diff" to generate a correct patch file that also includes empty files?

+3
python linux diff


source to share


No one has answered this question yet

Check out similar questions:

465
How do I colorize diff on the command line?
255
How do I install a `git diff` patch without Git?
122
How do I apply a diff patch on Windows?
13
How does diff / patch work and how secure are they?
nine
How do I make git-diff create a "context" diff format?
five
tfs. header line mismatch with patch command
five
Applying diff-patch to a line / file
1
diff and new empty files
0
How do I open a patch file (Mercurial) in a human readable format (preferably with kdiff3)?
0
Diff and Patch for Multiple Files



All Articles
Loading...
X
Show
Funny
Dev
Pics