views:

165

answers:

3

To follow up on my previous question Git work flow with an inexpirenced member. I choose to have him send patches to me. The problem is i haven't used patches before and i can't find tutorials giving explanation on the work flow.

What i want is have him pull the latest code from the repo. create a branch work on it commit his changes when he is done i want him to create a patch for it so i can integrate it into master.

Can you tell me how can i create patches in a situation like this and apply it to my master?

+2  A: 

That's relatively easy. Say the branch is foo, and the patches from master:

# Put every patch for revisions from master to foo into tmp: 0001, 0002, etc...
git format-patch master...foo --stdout > yo

....

# You apply the patches with git am
cat yo | git am

Note that it won't give you the same revisions as the original because of commiters differences. That's a bit more complicated in that case (http://home.regit.org/?page_id=32)

David Cournapeau
+4  A: 

Create patch with git-format-patch(1), or, if you want to send emails just git-send-email(1).

Then apply it with git-apply(1) or, for email, git-am(1).

drdaeman
+1  A: 

without commiting:

git pull
<hack>
git diff -p > myfirstpatch.txt

then he can email you the patch.

if he does commit, then just give diff some arguments.

git diff blah...blah2 -p >mysecondpatch.txt

then you just do:

git apply mysecondpatch.txt
Pod