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*
It seems that git bundle is the better option. Unlike git format-patch which is a one-way communication workflow, bundle allows you to leverage the same workflow you use with public remotes but are separated from direct access.
It is designed for sneaker-nets and would be perfect for students to save to USB or email bundles.
patches are more for submit for approval by a project lead style of communicating.