Perforce – create patch file of differences against have revision

diff()p4vperforce

In Perforce, how can I create a patch file which has the changes that are in the file as currently saved, compared to the have revision? Instructions for either the GUI client or the CLI client would be great.

I can see how to get the diffs between two changelists, but not how to just get the difference between the last changelist and the current state of the files. Additionally, I can see that in the GUI client, I can right-click on a file and select "Diff Against Have Revision" from the contextual menu, which shows me what I'm looking for, but I can't figure out how to get that into a file.

I'm basically looking for the equivalent of what git diff <file> > patch.diff does in Git-land.

Best Answer

I think that p4 diff -du FILE > patch.diff should do what you want.