Dev
Dev

Reputation: 13753

Empty patch created using "git format-patch origin/master --stdout"

I was looking into Drill's(open source github project) documentation to create a patch.

I came across this command:

git format-patch origin/master --stdout > DRILL-1234.1.patch.txt

I made some changes. I verified my changes by git status. I modified a .java file. I tried above-mentioned command to create a patch.

I opened DRILL-1234.1.patch.txt & its empty.

Then I tried git add <modified file> & tried the same command, still empty patch file.

What am I missing?

Upvotes: 4

Views: 4077

Answers (2)

CodeWizard
CodeWizard

Reputation: 141946

You must have some content (commits) in order to create path.
Commit your changes and the create a patch

git format-patch HEAD~X // x is the number of commits you need

Upvotes: 3

Igal S.
Igal S.

Reputation: 14534

Git format-patch creates patches from commits. So you have to perform git commit first.

Also - I don't think --stdout does what you think it does.

From here: https://git-scm.com/docs/git-format-patch

The names of the output files are printed to standard output, unless the --stdout option is specified.

format-patch creates one patch file for each commit you have. It does not output the file itself, but the name of the patches files.

Upvotes: 2

Related Questions