2012年3月27日 星期二

how to git format patch in project

#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#This only for one git project
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
$git checkout -b BSP-M1 remotes/pobu_git_server/BSP-M1
$git checkout PROJECT-M1
$git format-patch --binary -o __patches BSP-M1...HEAD
$git am __patches/*

#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#This for repo project
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#step1: Collect the patch file
$repo forall -pvc 'git checkout -b BSP-M1 remotes/pobu_git_server/BSP-M1'
$repo forall -pvc 'git checkout PROJECT-M1'
$repo forall -pvc 'git format-patch --binary -o __patches BSP-M1...HEAD'
$find . -name '__patches' -type d -print0 | xargs -0 tar czf patch.tar.gz

#step2: If you get new release and apply this patches
cd new_release
cp ../old_release/patches.tar.gz .
tar xzf patches.tar.gz
repo forall -pvc 'git am __patches/*'

#step3 : Solve conflicts
Dirty works. Use git am (--continue | --skip | --abort) to deal with it.
Please reference http://schacon.github.com/git/git-am.html.

#step4: Clean the patches
cd ../old_release
find -name '__patches' -type d -print0 | xargs -0 rm -f
cd ../new_release
find -name '__patches' -type d -print0 | xargs -0 rm -f

沒有留言:

張貼留言