日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

git apply 打补丁

發布時間:2023/12/20 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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 打补丁的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。