0

Is it possible to create a diff file that would work without having the actual files in the diff file?

e.g.: I have a folder /a and a copy of a: /b. In /b I edit multiple files and create a .diff file. I sent this file to someone else so they can use this file to update their /a folder.

I use the following to create the diff file: diff -ENwbur a b > file.diff

But which command does the other person use?

1

The other person would just use patch, try first:

patch --dry-run -p0 < file.diff

You might need to adjust the -p option (or drop it) according to how you passed the folder parameters to 'diff' and from which folder you are applying the patch, check the patch manpage for more details. But usually -p0 will work just fine if the other person applies the patch in the "same location" in which you created the patch.

Once you see that the patch command works without any rejections, you can remove the --dry-run option to actually applying it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.