Reputation: 840
Taking perforce diff when I try to patch this using git am
, it says "Patch format detection failed".
How do I get my changes from perforce and apply it to git branch?
This is the first few lines of diff
==== //depot/a.c#162 - /asdf/a.c ====
4326a4327,4642
> /*
> *----------------------------------------------------------------------------
> *
> * --
Upvotes: 3
Views: 9070
Reputation: 333304
Make sure you produce the diff with p4 diff -du
to get the unified diff format, which works much better with tools like patch
, and is (I believe) the only format that Git understands.
You also may need to edit the patch to take out the Perforce syntax; as you can see, the file name appears as //depot/a.c#162
, which patch
and git apply
may be interpreting as the actual filename; a.c#162
. Try removing the #162
part if that appears in your patch.
And depending exactly where you are applying the patch, you may need to pass -p1
to patch
or git apply
in order to strip off the leading /
, or -p2
to strip off the entire leading directory.
Upvotes: 6
Reputation: 225262
Use git apply
, or failing that use patch(1)
directly, then commit the results.
Upvotes: 0