When using git, I have a totally new file.
git diff
will show nothing.
I need to generate the diff content for other people.
ex:
git diff > 001.patch
How to let the 001.patch contains the new file's content?
A totally new file isn't tracked, and therefore wouldn't be shown by git diff
. I'd stage it by using git add ./path/to/my/new/file.txt
, along with git add
ing any other changes you may have, and then use git diff --cached
.