So, I try to patch my current branch using command
patch -p RETURN quote-patch.txt
However, I dont know what number should I put after -p option.I tried to put several number (0,1,2,3,4), but it return this error:
patching file RETURN
Hunk #1 FAILED at 74.
Hunk #2 FAILED at 84.
Hunk #3 FAILED at 95.
Hunk #4 FAILED at 107.
Hunk #5 FAILED at 139.
Hunk #6 FAILED at 187.
6 out of 6 hunks FAILED -- saving rejects to file RETURN.rej
any idea? thx
Your patch does not apply to your current working set.
Without more information, I cannot say why that is the case. Perhaps you changed
RETURNlocally before attempting the patch application. As the message suggests, try taking a look inRETURN.rej(andRETURNitself) to fix up the fallout.When using the
patchcommand-line utility, you should use a-pnumber which causes the paths in the patch to match up with those in your working set: If the patch header says+++ lib/foo/RETURN, and your current working directory hasfoo/RETURNin it, that would be a case for-p1.However, since you’ve tagged this question “git”, I’m going to assume you’re in a git repository. When using git, you shouldn’t use the
patchtool: instead, either push+pull changes naturally, or usegit format-patchandgit amto send and receive sets of changes. That will preserve permissions, commit messages, authorship information, and so on. All this extra metadata would be lost if you use a straightdiffand then apply the change withpatch.