The below worked for me.
Source:How to create and apply a patch with Git
First, take a look at what changes are in the patch. You can do this easily with git apply
git apply --stat fix_empty_poster.patch
Note that this command DOES NOT apply the patch, but only shows you the stats about what it’ll do. After peeking into the patch file with your favorite editor, you can see what the actual changes are.
Next, you’re interested in how troublesome the patch is going to be. Git allows you to test the patch before you actually apply it.
git apply --check fix_empty_poster.patch
If you don’t get any errors, the patch can be applied cleanly . Otherwise you may see what trouble you’ll run into.
To apply the patch, I’ll use git am instead of git apply. The reason for this is that git am allows you to sign off an applied patch. This may be useful for later reference.
git am --signoff < fix_empty_poster.patch
Applying: Added specs to test empty poster URL behaviour
Applying: Added poster URL as part of cli output
Okay, patches were applied cleanly and your master branch has been updated. Of course, run your tests again to make sure nothing got broken.
In you git log, you’ll find that the commit messages contain a “Signed-off-by” tag. This tag will be read by Github and others to provide useful info about how the commit ended up in the code.