git patch
1、根据某个commit id生成patch,每个提交都会生成一次补丁
git format-patch commitID
2、根据某个commit id生成patch,合并生成一个patch
git format-patch commitID--stdout > xx.patch
3、生成A提交点到B提交点之间
git format-path commitIDA..commitIDB
4、生成最近几次提交的path
git format-patch HEAD^ # 最近的1次commit的patch 其中HEAD^可用-1代替
git format-patch HEAD^^ # 最近的2次commit的patch 其中HEAD^可用-2代替
git format-patch HEAD^^^ # 最近的3次commit的patch 其中HEAD^可用-3代替
5、应用patch
检查patch文件
git apply --stat xxx.patch
查看是否能应用成功
git apply --check xxx.patch
应用patch
git am -s < xxx.patch