Syntax for patch on cmd line?

Running M1, I generated a patch from IDEA for a handful of files. I took the patch generated and tried running it against the same repository on another machine. I can't get patch to accept it, so am wondering what format/flags IDEA is using to generate the patch file.

Running patch 2.59 on Ubuntu.

Have been trying various permutations, like
>patch -i Mantis_6139.ptc -u --dry-run
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:

have tried
-p, --strip flags, with and without -u

Haven't found the right combination.


1 comment
Comment actions Permalink

OK, I found it

patch -p0 -u<patchfile

The issue is that (at least in my case, not sure if always), IDEA is generating filenames in the patch already relative to my module root; p0 (zero) indicates that. Format appears to be unified diff, hence -u



Please sign in to leave a comment.