2009年11月3日 星期二

Use output file of git-diff to patch

透過git-log可以看到如下git所有的commit紀錄:
commit 5619a29eaf0fa10f08ccca45f4e6942db523d212
Author: funkie_ko
Date: Tue Nov 3 18:19:24 2009 +0800

fix tt bug 139030: There will not pop up a puk unlock screen after input wrong pin three times into Settings

commit a423561d15fae91f50e66c09c741fcd9cdf58a20
Author: Merxxxcxk Hung
Date: Tue Nov 3 13:18:36 2009 +0800

Relocated strings which were created by xxxx to xxxx_strings.xml.

commit 1829bf9c370380dce1fa1145831dca668aecaa80
Merge: 897712a... 3c6bbcc...
Author: Olxxxiver Hu
Date: Sun Nov 1 12:46:54 2009 +0800

Merge remote branch 'origin/branch-xxxx' into branch-yyyy

commit 3c6bbcc7579d3723fc8ed79371ee2aaf15392b08
Author: Hxxxanes
Date: Fri Oct 30 18:47:04 2009 +0800

goal : distinguish android original strings and asus strings
modified: res/values/xxx.xml
modified: src/com/xxxx/settings/bluetooth/BluetoothSettings.java
step 1. create diff file.
$ git-diff <base-version-hash-number>..<target-version-hash-number> > output.diff
ex.
git-diff a423561d15fae91f50e66c09c741fcd9cdf58a20..5bdae902aebf45b107eac8303aea4fc5dc8208ab > ~/Settings.diff

step2. patch through the diff output file from step1.
$ patch -p1 < /home/funkie/output.diff

# patch –p[n] <>

-p[n] n , 只要取消多少條 / 及其左邊的路逕. /usr/src/linux 為例,

-p0 就是不取消任何路經

-p1 則將 / 取消, usr/src/linux

-p2 則是將 /usr/ 取消, src/linux

再以 src/linux 為例:

-p0 依然為 src/linux

-p1 則為 linux, 如此類推...

補充一下, 路徑的話,請用vim打開patch檔看

--- a/usr/src/linux 2008-04-05 18:23:00.000000000 +0800

+++ b/usr/src/linux 2008-04-05 18:24:27.000000000 +0800


沒有留言:

張貼留言