生成补丁
# git format-patch -M master // 当前分支所有超前master的提交
# git format-patch -s hash_code // 某次提交以后的所有patch, --hash_code指的是SHA1 ID
# git format-patch -1 hash_code // 单次提交
# git format-patch -3 // 从master往前3个提交的内容,可修改为你想要的数值
# git format-patch –n 07fe // -n指patch数,07fe对应提交的名称, 某次提交(含)之前的几次提交
# git format-patch -s --root origin // 从origin到指定提交的所有patch
应用补丁
先检查patch文件:# git apply --stat newpatch.patch
检查能否应用成功:# git apply --check newpatch.patch
打补丁:# git am --signoff < newpatch.patch
(使用-s或--signoff选项,可以commit信息中加入Signed-off-by信息)
查看某版更新涉及到的文件
#git diff --name-only OLD_COMMIT_ID_HERE NEW_COMMIT_ID_HERE