I am trying to create a diff & apply a patch. For that I have created a blank text file & committed it, now I am adding "Hello world" in the text file & committing it. Using the git diff command I can see the diff as:
$ git diff
diff --git a/New Text Document.txt b/New Text Document.txt
index e69de29..b0a6290 100644
--- a/New Text Document.txt
+++ b/New Text Document.txt
@@ -0,0 +1 @@
+Helo world
\ No newline at end of file
Now I am creating patch with the command git diff >first.patch. The file gets created, now I am switching to another branch using git checkout -b dummy & here if I try to apply the patch with the below command I get the error as shown. What's wrong?
git apply first.patch
error: patch failed: New Text Document.txt:0
error: New Text Document.txt: patch does not apply