Creating Patch in git is quite easy and useful when you want to transfer your changes from one branch to another or from one machine to another.
so here is the command you use:
once you clone repo from git using :
git clone git://github.com/xyx/xyx.git cd xyx git checkout -b branch_1
git checkout -b : it will create new branch with branch_1 name
git log --pretty=oneline -3 git format-patch master --stdout > patch_name.patch
above command create new patch file with name patch_name.patch.
now applying patch:
use following command to easily apply patch to branch, apply command shows what are the changes patch will do in your current branch
git apply --check patch_name.patch
use following command to apply the patch
git am --signoff < patch_name.patch