I am having a little trouble here with git and applying a patch.
I am trying to apply this patch: https://www.drupal.org/node/2309321
To this module: https://www.drupal.org/node/2309089
I know, that those are both Drupal links, but that is not the problem here. You can simply download the module and put the patch in the same folder. No Drupal needed for this.
For reference: I named the patch eck_test.patch
.
This what I have tried so far:
git apply -v eck_test.patch
No output at all.
git apply -v --whitespace fix eck_test.patch
No output at all.
git am eck_test.patch
Patch format detection failed.
I have no idea, why this is not working.
Both line endings are the same, regarding to Sublime Text.
There are a lot of topics about this on the net, but I found none of them working for me. I hope you have some idea, because git seems like, it does not want to help me. :/
A patch is usually skipped when the changes it contains were already applied in the past. There are many possible reasons for this: a merge, a cherry-pick, changes operated manually or using another patch etc.
GIT patch or GIT diff is used to share the changes made by you to others without pushing it to main branch of the repository. This way other people can check your changes from the GIT patch file you made and suggest the necessary corrections.
What is git am ? git am is a super useful command which can be used for many things as it's reading and parsing the mailbox containing the commits you specify and allows you to use only parts of the extracted data such as the code diff, the autor, the message…
I had the same symptoms. When I tried patch -p1 --dry-run < [patch name].patch
, as suggested by @martin in a comment, it gave some helpful output: "Hunk #1 FAILED". Looking more closely at the patch, I realized that there was a conflict in the patch, which git apply
had failed to report. (The patch was trying to delete a line, but the line being deleted was different in the patch vs. my working copy.) So the solution was to fix the patch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With