git format-patch

使用git format-patch生成所需要的patch:

# git format-patch -s 1bbe3c8c197a35f79bfddaba099270a2e54ea9c7

please replace the hash code with your repo previous commit.

then you can find the patch under repo directory.

then mail your patch to configuration admin.

# git format-patch -M master         // 当前分支所有超前master的提交

# git format-patch -s 4e16                // 某次提交以后的所有patch,--4e16指的是SHA1 ID

# git format-patch -1//单次提交

# git format-patch -3                    // 从master往前3个提交的内容,可修改为你想要的数值

# git format-patch –n 07fe            // -n指patch数,07fe对应提交的名称, 某次提交(含)之前的几次提交

#git format-patch -s --root origin// 从origin到指定提交的所有patch

应用patch:

先检查patch文件:# git apply --stat newpatch.patch

检查能否应用成功:# git apply --check  newpatch.patch

打补丁:# git am --signoff < newpatch.patch

(使用-s或--signoff选项,可以commit信息中加入Signed-off-by信息)

或git am

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • git常用命令 GIT常用命令备忘:http://stormzhang.com/git/2014/01/27/gi...
    新篇章阅读 12,761评论 1 26
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,463评论 19 139
  • Add & Commit git init 初始化一个 Git 仓库(repository),即把当前所在目录变成...
    冬絮阅读 10,373评论 0 9
  • 今日查房,主任交代一个子宫肌瘤术后2天出院病人,意思让其术后多活动,不要一直躺床上,但说话可能简单了点,说:回到家...
    sunny玫201617阅读 1,267评论 1 1
  • 今天在各种搞自定义宏,替换NSLog。修改宏的次数特别多。大家都知道修改任意一个宏,项目就要重新编译。原来项目编译...
    BetterComingDay阅读 4,489评论 1 2