we dont always maintain the code we work on, in that case patches are necessary. so this is me learning how to use quilt
this just includes a hello world program. from there I changed it to say goodbye world. after the change i did git diff > patches/hello.patch
, I also added a series file in the patches directory with hello.patch
as its contents. from there i stashed the git changes to revert the hello.c file to say hello world again. This file is changed through quilt
quilt push -a
this applies all the patches
quilt pop -a
removes all the patches
the makefile simply
- compiles the original hello.c (with hello world)
- runs the hello program
- applies the patch
- compiles the patched hello.c file (with goodbye world)
- runs the patched hello program
clone this repo
check the original hello.c file by cat hello.c
#include <stdio.h>
int main(void){
printf("\nhello world\n");
return 0;
};
in the directory just run make
it'll say
running original hello
hello world
Applying patch patches/hello.patch
patching file hello.c
Now at patch patches/hello.patch
running patched hello
goodbye world
check the hello.c after the patch is applied cat hello.c
#include <stdio.h>
int main(void){
printf("\ngoodbye world\n");
return 0;
};
lastly run a make clean
to revert to original and check the hello.c file like before