通过git diff 命令生成patch文件
1.还未提交的修改
命令 :git diff > commit.patch
2.已提交的修改
先用git log命令查看commit id soft04@lzy-pc:~/work/code/p716qc-e3x-qz-noback$ git log commit 8b5100cdcd3895c1b9f44ef042b120fd2b4dfc7b Author: xxxx <xxxx@163.com> Date: Tue Nov 19 18:45:05 2019 +0800 test commit 3da71ca35b7d62894330dbdf8cee1d653a3e26df Author: xxxx <xxxx @163.com> Date: Thu Nov 14 16:21:18 2019 +0800 去掉toast 通过命令生成patch 命令 :git diff 3da71ca35 8b5100cdcd > commit.patch
3.已经add但是未commit的修改
命令 :git diff --cached > commit.patch
4.检查patch是否可以应用
命令 :git apply --check commit.patch
5.查看patch文件
命令 :cat commit.patch
6.打补丁
命令 :git apply commit.patch
生成的commit.patch文件
转载于:https://blog.csdn.net/wxd_csdn_2016/article/details/103148577