Reputation: 16794
When I try to perform a patch using:
git am 0001-someFile.patch
but I get this error:
error: patch failed: src/***/file.c:459
error: src/***/file.c: patch does not apply
Patch failed at 0001 someFile.patch
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
I am trying to manually merge the conflicts using:
git mergetool --tool=meld
But I am getting:
No files need merging
How can I solve this problem? I am getting the name of the file which holds the error, but have no idea about the line (it's a big file)
Maybe there is a better way to perform such patching?
Upvotes: 4
Views: 3694
Reputation: 10947
You need to do a 3-way merge:
git am -3 0001-someFile.patch
git mergetool -t meld
Upvotes: 0
Reputation: 1666
I'm in charge of handling all patching at my work. I've had this happen many times. A patch cannot be merged. The reason this is happening is because the master branch has changes that the patch did not take into account, which prevents it from patching correctly. From all my experience, this could be caused by several things:
Here is the flow I've had the most success with. (This is assuming the person is developing on a branch other than master)
That makes sure your patch is up to date with the origin master branch. Send that patch and hopefully the patch is applied before too many changes are made on the master.
Upvotes: 1