[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sending git patches
From: |
Johannes Schindelin |
Subject: |
Re: sending git patches |
Date: |
Sun, 30 Sep 2007 04:07:55 +0100 (BST) |
Hi,
On Sat, 29 Sep 2007, Graham Percival wrote:
> Suppose that a nice helpful GDP helper has git working. They make some
> changes, commit stuff, make more changes, commit more. Now what's the
> best way for them to send these changes to me?
>
> (assuming that they don't have write access to the repository)
>
> I know that git has a huge number of git-diff options; what's the best
> option in this situation?
The easiest way would be this:
$ git format-patch -<n>
where <n> is the number of patches your helper did. This command will
output as many files, named 0001-<bla>.patch, ... (where <bla> is the
oneline of the respective commit).
Now these patches can be sent either inline or as attachments. If they
are sent inline, you (Graham) save them in mbox or maildir format (your
mailer should do that for you when you create a new folder and copy the
mails there). If they are sent as attachments, just save them as-are.
Now comes the fun part: applying them.
$ git am <file-or-maildir>
(I actually like the "-i" option which asks me if I want to apply this or
that patch.)
Note: if the patches are sent inlined, the _sender_ has to make sure that
the mailer does not do bad things to the patch (such as deleting a single
space on a line, which _has_ a meaning in a diff). Many mail programs
need to be taught not to touch the text; others cannot be taught (most
notably the GMail web interface!).
So in short: helper executes something like "git format-patch -1", sends
the result, and you apply it with "git am <file-or-maildir>".
Hth,
Dscho
- sending git patches, Graham Percival, 2007/09/29
- Re: sending git patches,
Johannes Schindelin <=