sneakyimp;11044165 wrote:
haven't had any luck getting it to work on a repo for me.
3233b8 ..HEAD
That's because of the leading whitespace before the double-dots ..
The two commits point are specifying a range in this case, and so the double-dots should connect the two commits
git format-patch 90c7a00d9e285c70a68e4e82e24e1fe8343233b8..HEAD --stdout
sneakyimp;11044165 wrote:
Also, am I correct that "git am" applies a patch to a repo?
Yes. It goes together with format-patch, just like apply goes together with patch files created by gitt diff.
sneakyimp;11044165 wrote:
Can you suggest where I might learn more about the use of this function? I've tried git am --help[/man] and am not sure I understand that it actually does. In particular, this doesn't help me understand what your command is doing:
DESCRIPTION
Splits mail messages in a mailbox into commit log message, authorship information and patches, and applies them to the current branch.
Things will become clear when you remove the extra whitespace and get output from format-patch. format-patch creates patches and formats them as mail messages, with one commit per message / file. Using --stdout > outfile, you may combine them all into one file. When you git am such a file, each patch is applied in succession, including committing the changes. git diff would only affect the working tree.
Manpage: https://www.kernel.org/pub/software/scm/git/docs/git-am.html (which i guess contains same as --help)
Some info about patch workflow: http://rypress.com/tutorials/git/patch-workflows
Other than that, you can usually find more resources when searching: stackoverflow questions, blog entries, examples etc.
Perhaps I should point out that the patch work-flow has been reversed from how it usually works (was intended to work) when used to implement "strategy 2" above. Usually, you send patches to the "main" repo. Patches are then applied in the main repo, and if anyone wants to continue working, they'd fetch from that repo again. This is done so that commit histories remain the same everywhere. If different people apply commits in different orders, things wouldn't look the same everywhere. Moreover, commit checksums are in part based on commit-time information, such as committer and commit date.
In order to use patches to update client's repos as per "strategy 2", the patches now flow from main repo to others, instead of from others to main. I still believe it is better to distribute updates by having client repos fetch from main repo... But if strategy 2 is chosen as outlined above, it is still simpler to implement with patch files. You just have to make sure commits are done "by the same user" (git config user.name and git config user.mail to set each client repo to whatever you use locally). When you run git am, also supply --committer-date-is-author-date to retain the commits original time.