git apply 打补丁
一:生成patch 和打patch
有这样的 目录层次 x/xx/xxx/xxx/test.c
我的当前位置是在 x/ 下 ,执行 git diff> test.patch
在test.patch补丁文件里的路径信息是这样的:
- - - a/xx/xxx/xxx
+++b/xx/xxx/xxx
如果 应用 test.patch 的时候的 位置 是在 x/ 下,
执行:
patch -p1 < test.patch
--------------------------------------
git diff> test.patch,这是产生patch的方式。
注意,使用gitdiff产生的patch都应该在执行 patch 命令时, 指定-p1,当 位置是 【在哪里制作的patch,就在哪里 执行】
二:
$git apply 0006-Philips-VSO-library-Report-only-the-actual-data-to-a.patch
error: patch failed: sensors-see/sensors-hal/sensors/philips_rr.cpp:81
error: sensors-see/sensors-hal/sensors/philips_rr.cpp: patch does not apply
error: patch failed: sensors-see/sensors-hal/sensors/philips_spo2.cpp:81
error: sensors-see/sensors-hal/sensors/philips_spo2.cpp: patch does not apply
$ git am --reject 0006-Philips-VSO-library-Report-only-the-actual-data-to-a.patch
Applying: Philips VSO library: Report only the actual data to application i.e. data[5].
Checking patch sensors-see/sensors-hal/sensors/philips_rr.cpp...
warning: sensors-see/sensors-hal/sensors/philips_rr.cpp has type 100755, expected 100644
Checking patch sensors-see/sensors-hal/sensors/philips_spo2.cpp...
Applied patch sensors-see/sensors-hal/sensors/philips_rr.cpp cleanly.
Applied patch sensors-see/sensors-hal/sensors/philips_spo2.cpp cleanly.
git apply --reject xxxx.patch
自动合入 patch 中不冲突的代码改动,同时保留冲突的部分。这些存在冲突的改动内容会被单独存储到目标源文件的相应目录下,以后缀为 .rej 的文件进行保存。
比如对 ./test/someDeviceDriver.c 文件中的某些行合入代码改动失败,则会将这些发生冲突的行数及内容都保存在 ./test/someDeviceDriver.c.rej 文件中。我们可以在执行 git am 命令的目录下执行 find -name *.rej 命令以查看所有存在冲突的源文件位置。
$ git am --reject 0007-Adjust-the-touch-threshold-as-low-as-possible-to-mak.patch
Applying: Adjust the touch threshold as low as possible to make the off-body distance shorter
Checking patch sensors-see/registry/config/A4100/sdm429w_pah_8131_0.pah_8136.param_cal.json...
error: while searching for:
"8": {
"type": "int",
"ver": "0",
"data": "124328280"
},
"9": {
"type": "int",
"ver": "0",
"data": "40961131"
},
"10": {
"type": "int",
error: patch failed: sensors-see/registry/config/A4100/sdm429w_pah_8131_0.pah_8136.param_cal.json:48
error: while searching for:
"data": "1117"
}
}
}
error: patch failed: sensors-see/registry/config/A4100/sdm429w_pah_8131_0.pah_8136.param_cal.json:81
Applying patch sensors-see/registry/config/A4100/sdm429w_pah_8131_0.pah_8136.param_cal.json with 2 rejects...
Rejected hunk #1.
Rejected hunk #2.
Patch failed at 0001 Adjust the touch threshold as low as possible to make the off-body distance shorter
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
git apply 打补丁相关推荐
- git apply、git am打补丁.diff 和 .patch
前提: 生成patch: git format-patch -M master 生成指定patch,0163bed3bf59ae74c36cc5138b4c24f1556d8304是commit id ...
- Git补丁简单用法介绍(打补丁.diff 和 .patch 和 git apply、git am应用)
打补丁.diff 和 .patch 和 git apply.git am应用 生成patch git format-patch -M master 生成指定patch,afc425592dc7dde9 ...
- 使用git命令打补丁
一. patch 和diff 的区别 Git 提供了两种补丁方案,一是用git diff生成的UNIX标准补丁.diff文件,二是git format-patch生成的Git专用.patch 文件. ...
- Git版本控制管理——补丁
Git实现了自己的传输协议用于版本库间交换数据.出于效率方面的考虑(为了节约时间和空间),Git传输协议会进行握手,以确定原版本库中的哪些提交不在目标版本库中,最终传输提交的二进制压缩形式.接收的版本 ...
- git am, git apply, git format-patch,git diff 用法
传统的patch可能会丢失一些信息,git 提供两种打patch方法, git diff , git format-patch,两种的区别在于前者打出来的patch中不带有提交信息, 后者打出来的pa ...
- git解决git apply时遇到trailing whitespace问题
git解决git apply时遇到trailing whitespace问题 参考文章: (1)git解决git apply时遇到trailing whitespace问题 (2)https://ww ...
- 【转载】Git 常用命令大全
一. Git 常用命令速查 git branch 查看本地所有分支 git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支 git branch ...
- Git 常用命令速查表(图文+表格)
一. Git 常用命令速查 git branch 查看本地所有分支 git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支 git branch ...
- Git 常用命令速查表(图文+表格)【转】
转自:http://www.jb51.net/article/55442.htm 一. Git 常用命令速查 git branch 查看本地所有分支 git status 查看当前状态 git co ...
最新文章
- 使用 Flash Builder 的 Apple iOS 开发过程
- JS高级程序设计拾遗
- java mongodb 使用MongoCollection,BasicDBObject 条件查询
- ubtunu打开firefox_ubuntu中火狐浏览器问题(也许是)
- Bootstrap datepicker 在弹出窗体modal中不工作
- Openstack 一直在调度中解决
- LeetCode MySQL 1127. 用户购买平台 *
- python多任务_【python】多任务(1. 线程)
- cnBlog的windows live writer 客户端配置
- springboot系列十二 Spring-Data-ElasticSearch Jpa、QueryBuilder、MatchQuery、位置搜索、GeoPoint...
- php 后台数据 u,Yunucms代码审计:后台XSS和数据库信息泄露
- 深击 | 阿里云故障“惊魂”1小时:难道我们是那0.1%?
- 【转载】PCB设计方法和技巧
- 新手入门linux必看
- wisp5.0 学习日记2
- ArcSDE版本学习总结
- RedisUtils工具类,设置缓存,然后需要在删除,更新插入的时候清空缓存,保持redis和mysql的数据一致
- MCNP 学习笔记之空气比释动能(F4 F5 计数卡)
- ipv4v6双栈技术_IPv6过渡技术之双栈技术
- 2021年中国轿车行业现状分析,产销量回升,行业逐渐回暖「图」
热门文章
- java中文括号转英文
- 广告联盟反作弊一些常识
- 行人重识别 MSMT17数据集描述
- java基于springboot房产备案管理系统
- 三星s5 安装android,三星手机怎么安装软件?三星手机安装被阻止情况的解决办法介绍...
- c语言中 5.1lf什么意思,期货股指lf_中金所期货指数IF、IH、IC分别是什么英文单词的缩写_期货攻略网...
- 2021-2027全球与中国可持续性蛋白质市场现状及未来发展趋势
- 游戏音效有哪些分类你知道吗
- 销售中提问的技巧 PPT培训资料
- Python入门笔记(三)