首页 > 技术文章 > git生成patch

solomarge 2021-11-25 16:20 原文

一、通过git diff 命令生成patch文件
1.还未提交的修改
git diff > commit.patch
2.已提交的修改
git diff 3da71ca35 8b5100cdcd > commit.patch
注)3da71ca35 在8b5100cdcd 前面
3.已经add但是未commit的修改
git diff --cached > commit.patch
4.检查patch是否可以应用
git apply --check commit.patch
5.打补丁
git apply commit.patch

推荐阅读