How to apply patches in git when multiple patches has some common changes?

41 Views Asked by At

Basically, I've created patch for legacy software. In which there is cli fetch, so while doing cli changes, I need to made some changes in service as well. And also, while doing service patch from fresh repo, I've made changes and some of the changes are already done in the previous cli patch. So, when I'm trying to apply service patch after cli patch, I got the following error:

git apply service.patch
error: patch failed: service/auth/auth.java:8
error: service/auth/auth.java: patch does not apply
error: patch failed: service/config/utils.java:4
error: service/config/utils.java: patch does not apply

Although, both file has same changes, still it give above error. I couldn't see the conflict in the file, so I can resolve it. Any suggetion. By the way I've created the patch using following way: Step 1: Made changes and staged it using git add . Step 2: git diff --cached > service.patch

I've check the difference if there any conflict in the both patches, but I found there is no conflict.

0

There are 0 best solutions below