使用diff制作补丁【学习笔记】

源文件:main.c

#include <stdio.h>

int main()
{
  printf("hello");     
}

修改之后的文件:

main1.c

#include <stdio.h>

int main()
{
  printf("hello");    
  printf("world");   
}

生成补丁的命令:

diff -up maint main1.c > example.patch

打补丁命令

patch -p1 < example.patch

如果打补丁失败生成main.c.rej,main.c.orig必须通过手工来合补丁

原文地址:https://www.cnblogs.com/zzb-Dream-90Time/p/8794379.html