git am: Patch format detection failed

Aaron Franke picture Aaron Franke · Mar 16, 2018 · Viewed 14.3k times · Source

I have never used patches with Git before and I need some help. I am trying to apply a patch to a Git repo to test a Wine patch, specifically this patch here. So I did the following:

$ git clone git://source.winehq.org/git/wine.git
$ cd wine
$ nano patch.p1

I then pasted the content of the patch with Ctrl+Shift+Vand used Ctrl+O to save. Then I tried this:

$ git am patch.p1
Patch format detection failed.

What am I doing wrong? I have never applied a patch before.

Answer

user276648 picture user276648 · Oct 3, 2018

Patch format detection failed. probably means you're using the wrong command: use git apply instead of git am or the other way around.

See What is the difference between git am and git apply? for more on the difference between the 2.