Andry Andry - 1 year ago 77
Git Question

Git `format-patch` returns nothing

I am trying to create a patch for a commit in my repository.

  • System: Windows 10

  • Tools Git Windows Desktop and Git Shell
    git --version => git version

When I try to create the patch I go:

git format-patch master
git format-patch master -o C:\Users\MyUser\Desktop
git format-patch master --stdout > C:\Users\MyUser\Desktop\MyPatch.patch

In all 3 cases, I get nothing. In the first 2 cases, no file is saved in the locations I specify. In the third case, the generated file is 0 bytes.

State of my repository

I have pushed everything to master. So I have no more local unstaged or staged commits. Everything is on the server.

Also, if I change a file and have unstaged changes, still it does not work.

I've also tried:

git format-patch <ccommit-sha>

Using the SHA hash of a commit I pushed. Still does not work.

What am I doing wrong?

Answer Source

To create patch you need to specify what should be used to create it. If you want to create patch using last commit from master branch just call git format-patch -1 master. For more information, please check format-patch documentation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download