Monday, April 8, 2013

git - patch

1. Download the patch from gerrit.
$ git fetch http://review.whamcloud.com/p/fs/lustre-release refs/changes/22/3522/4 && git format-patch -1 --stdout FETCH_HEAD > LU-1488.patch
 
2. Checkout the right git repo with correct 'tag'
$ git checkout -b clstr-1136 v1_8_8_WC

 
3. git branch
$ git branch
* clstr-1136
 master

4. apply patch
4.1 git apply -stat
$ git apply --stat LU-1488.patch
lustre/mdc/mdc_fid.c |   10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
 
4.2 git apply --check
$git apply --check LU-1488.patch
$
4.3 git apply
$ git apply LU-1488.patch
 
5. Use 'git cherry-pic' instead
5.1 $ git log v1_8_9_WC1 --oneline --all | grep LU-1488
944d1c1 LU-1488 mdc: fix fid_res_name_eq() issue.
 
5.2 $ git branch
* clstr-1136
master
 
5.3 $ git cherry-pick 944d1c1
 
 

No comments: