Thursday, May 10, 2007

mutt and git format-patch

Earlier today, I was looking for some basic instructions on using git-format-patch with mutt. It turns out to be really easy.
$ git branch
* log-decorate
  master
$ git format-patch origin
0001-Document-git-log-decorate.patch
$ mutt -H 0001-Document-git-log-decorate.patch
Then enter the To: address, accept the Subject:, add any touch ups, and send. When mutt's finished, it'll exit. Receiving and applying patches through mutt is pretty easy also. Using mutt trickiness, these steps can be automated, but here's the basic process:
  1. Find the email with the patch you want to apply
  2. Press s (or whatever save-message is bound to)
  3. Enter a path where you want to save the message
  4. Repeat steps 1-3 (entering the same path) to save additional patches in a mailbox
  5. Apply the patches while in your working tree: git am /path/to/patch-mailbox
Each patch is applied as a single commit. Read the documentation for git cherry to determine which of your patches have been applied upstream.

2 comments:

Martin said...

Thanks, I was looking for that all day :-)

Anonymous said...

Hey very nice blog!! Man .. Beautiful .. Amazing .. I will bookmark your blog and take the feeds also...