Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Got it working, thank you! –  memoryStream Feb 28 at 11:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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