The purpose of the make a patch file is that we want our specific git commit(s) to apply to other git repo.
Users could apply the patch file(s) to migrate OMADM related code.
work through:checkout to the commit that we want to start with.
→ cherry-pick related commit ID(here we do git log --oneline | grep -aE "omadm")
→ git format-patch [first commit id(included)]^..[lastcommit id] --stdout > [file_name].patch
Build Version:SC60_Android9_R05_r029
Steps.
1.git status
to make sure git repo is good to go
2.git checkout d504a83f02
3.git cherry-pick 105f8acf76
git cherry-pick a8bfe9d80a
git cherry-pick ea4d1b92fa
git cherry-pick 76e11f7778
collection for specific commit(s)(this si the way to make a git patch from multiple commits at different points in history)
4.git log --pretty=format:"%h - %an, %ar : %s"
make sure commit(s) are listed by time after cherry-pick(s)
5.git format-patch d504a83f02ca2e664a6b922a64f37a78c0a4a190^..9cfc641eae --stdout > Omadm_migrating_SC60_Android9_R05_r029.patch
choose the first commit id and the last commit id then patching all of them.
6. using patch file
git am patch/OMADM_migrating_SC60_Android9_R05_r029.patch
double-check the commits that have applied to the git repo
Congratulations! you have made the patch file
网友评论