diff and patch

时间:2022-12-26 23:10:45

A patch captures the changes of two different files (oldfile and newfile). Given the oldfile and the patch, one can use the patch program to create the newfile. This is exactly what we want. When you have done all the modifications, you can perform a command like this:

diff -ruNp minix_src_clean/ proj0/ > patch

this will creat a new file called patch.

You can test whether your patch has worked by creating another copy of the source tree and running patch as so:

cp -r minix_src_clean test
cd test
patch -p1 < ../patch