From: Junio C Hamano Date: Wed, 13 Aug 2008 00:25:41 GMT Subject: Re: Why doesn't git-apply remove empty file Message-ID: <7vod3xpxq2.fsf@gitster.siamese.dyndns.org> In-Reply-To: <38b2ab8a0808120917h10f15c81v4d1f04c0174dc994@mail.gmail.com> If you want to create an empty file, the patch would look like this: diff --git a/bar b/bar index 257cc56..e69de29 100644 --- a/bar +++ b/bar @@ -1 +0,0 @@ -foo On the other hand, if you want to remove an empty file, the patch would look like this: diff --git a/bar b/bar deleted file mode 100644 index 257cc56..0000000 --- a/bar +++ /dev/null @@ -1 +0,0 @@ -foo A patch generated by non-git tools would lack "index" and "deleted" lines, but they will still have difference between "bar" and "/dev/null" on the postimage filename (i.e. "+++" line), and git-apply leaves an empty file for the former, and removes the file for the latter patch.