git如何打补丁?
git cherry-pick 可以把某个分支的某几次提交合入到当前分支,只是在一台设备上操作。
git format-patch 可以把某个分支的n次提交分别打成n个补丁,然后把这些补丁文件(比如0001-.patch)发给其他人,或者发到其他机器,他们在自己的机器上,把这些补丁合入到他们当前的代码中。
比如,分支erebus20180910相比master分支,多了一次提交,打补丁就生成一个补丁文件

参考:https://www.jianshu.com/p/814fb6606734
1、在git源码目录下执行
1.1、两个commit间的修改(包含两个commit)
git format-patch <r1>..<r2>
如:
git format-patch d77aaac74845435744c49ae65511d9e1be79ed5c...046ee8f8423302f5070ca81b4e246516e919cd7a -o patch
1.2、单个commit
git format-patch -1 <r1>
1.3、从某commit以来的修改(不包含该commit)
git format-patch <r1>
2、 把生成的patch文件拷贝到目标git目录下
3、测试patch
3.1、 检查patch文件
git apply --stat 0001-minor-fix.patch
3.2、 查看是否能应用成功
git apply --check 0001-minor-fix.patch
4、应用patch
git am -s < 0001-minor-fix.patch
git如何打补丁?的更多相关文章
- git diff 与git format-patch 生成补丁包
git diff commit_id 会生成最后一次提交到目前修改过的内容补丁 git diff commit_id1 commit_id2 会生成两次提交之间修改过的内容补丁 git format- ...
- git apply、git am打补丁.diff 和 .patch【转】
本文转载自:https://www.jianshu.com/p/e5d801b936b6 前提: 生成patch: git format-patch -M master 生成指定patch,0163b ...
- 用git difff 生成补丁
http://stackoverflow.com/questions/1191282/how-to-see-the-changes-between-two-commits-without-commit ...
- git用法-打补丁
1. git cherry-pick 作用:从一个branch上选择一个commit,添加该commit到另一个branch上. 1. 切换到你想添加commit的分支上. git checkout ...
- git用法-打补丁【转】
本文转载自:https://www.cnblogs.com/yandufeng/p/5580765.html 1. git cherry-pick 作用:从一个branch上选择一个commit,添加 ...
- git diff 打补丁
[root@workstation2017 demo]# git diff old new >cc.diff[root@workstation2017 demo]# cat cc.diffdif ...
- 如何使用git send-email发送补丁?
答: git send-email <patch-name> --to <username>@<example>.com --cc <username> ...
- 常look的Git命令
常用的Git命令 命令 简要说明 git add 添加至暂存区 git add–interactive 交互式添加 git apply 应用补丁 git am 应用邮件格式补丁 git a ...
- Git常用命令学习(2)
1):git branch -v --查看每一个分支的最后一次提交2):git branch --merged 与 --no-merged 这两个有用的选项可以过滤这个列表中已经合并或尚未合并到当前分 ...
随机推荐
- [bzoj1798][Ahoi2009]Seq——线段树+多重标记下传
题意 请你写一个数据结构,支持: 子序列同加 子序列同乘 统计子序列和 题目 线段树裸题,但对于我这种初学者还是非常难写. 我们维护两个标记,一个是在这个节点上作过的所有乘法操作,一个是加法操作,始终 ...
- bzoj 1061 志愿者招募 费用流
详见BYV的博客,写的非常全面https://www.byvoid.com/blog/noi-2008-employee /************************************** ...
- python 实现定时循环触发某个方法
直接贴上代码 import threading def sayhello(): print "hello world" global t #Notice: use global v ...
- objc_msgSend arm64 崩溃问题
http://blog.csdn.net/chenyong05314/article/details/42121001 2014-12-24 10:49 878人阅读 评论(0) 收藏 举报 转载自: ...
- 【乱入】Uva11021麻球繁衍
就是根据概率公式入门算算. #include<bits/stdc++.h> ; int n,m,k; double p[N],f[N]; int main(){ int T;scanf(& ...
- MATLAB作图方法与技巧(三)
1.利用指令plot绘制圆的参数方程x = sin(t),y = cos(t),(0<=t<=2*pi)的曲线图. 代码如下 t = linspace(0,2*pi,100); x = s ...
- .net开发CAD2008无法调试的解决方法
把acad.exe.config文件修改为:------------------------------------------------------------------------------ ...
- AC日记——中山市选[2009]小明的游戏 bzoj 2464
2464 思路: 最短路: 代码: #include <cstdio> #include <cstring> #include <iostream> #includ ...
- 使用jsonp进行跨域请求
使用jsonp进行跨域请求 在实际的业务中很多时候需要用到跨域请求,然而jsonp为我们提供了一种非常方便的跨域请求的方式,具体实现代码如下: $.ajax({ type:"get" ...
- (十四)基于GTID的主从复制
(1)GTID主从复制 1)环境介绍 /etc/redhat-release CentOS Linux release 7.3.1611 (Core) MySQL版本:5.7 mysql> se ...