Seeking examples of workflow using git-format-patch and git am

I'm thinking of asking my students to use git for pair programming. Because student work has to be secret, a public repo is out of the question. Instead, each student will have a private repo they maintain themselves, and they will need to exchange patches using git-format-patch. I've read the man page but I'm a little unclear which patches will be sent. The obvious thing for the students would be send all patches since the last send or (if git doesn't mind receiving the same patches redundantly) send all patches since the dawn of time. (Remember these are student projects, they last for a couple of weeks and are small, and performance is not a criterion.) Our best friend is simplicity and we are fond of brute force as well.

Can anyone give me a short series of examples that show two people, each with a private git repo, exchanging patches using git-format-patch and git-am? Or alternatively point me to existing git documentation and/or tutorial?


It works best if they can see each other's git repos. git itself is managed this way (there's a public repo people can reference, and then they format-patch from there). If people never see each other's repos, things are a bit more difficult...

One thing they may do is maintain a reference to the last time they did a format patch. Let's say they start by just sending their entire tree (including .git):

tar cvf - mytree | gzip -9vc > /tmp/mytree.tgz
# mail /tmp/mytree.tgz
git tag last-send
# hack, commit, hack, commit
git format-patch -M -C last-send..
# mail 00* && rm 00*
git tag -f last-send

git tag in this form creates a "lightweight tag. It's a sort of bookmark. This will be an easy way for people to keep track of what they sent so they can send it again next time.

On the other side:

# get patches from mail and place in /tmp
git am /tmp/00*
rm /tmp/00*

Need Your Help

Standardization for interaction with on-line software invoicing

protocols standards saas

I am writing a software which sells certain service to it's user. I am aware of hundreds of different invoicing tools around - Freshbooks, Invocie machine, Xero, SortMyBooks are just to name a few....

SQL query to get neighbours from table with two dimensional data

sql database algorithm postgresql

I have a table, that contains partitioning of world map. Partition is done by splitting all area into rectangles, called 'tile'. As usual, rectangle has bottom-left and upper-right corners, both re...