Documentation / git-format-patch.txton commit user-manual: use pithier example commit (e2618ff)
   1git-format-patch(1)
   2===================
   3
   4NAME
   5----
   6git-format-patch - Prepare patches for e-mail submission
   7
   8
   9SYNOPSIS
  10--------
  11[verse]
  12'git-format-patch' [-n | -k] [-o <dir> | --stdout] [--thread]
  13                   [--attach[=<boundary>] | --inline[=<boundary>]]
  14                   [-s | --signoff] [<common diff options>] [--start-number <n>]
  15                   [--in-reply-to=Message-Id] [--suffix=.<sfx>]
  16                   [--ignore-if-in-upstream]
  17                   [--subject-prefix=Subject-Prefix]
  18                   <since>[..<until>]
  19
  20DESCRIPTION
  21-----------
  22
  23Prepare each commit between <since> and <until> with its patch in
  24one file per commit, formatted to resemble UNIX mailbox format.
  25If ..<until> is not specified, the head of the current working
  26tree is implied.  For a more complete list of ways to spell
  27<since> and <until>, see "SPECIFYING REVISIONS" section in
  28gitlink:git-rev-parse[1].
  29
  30The output of this command is convenient for e-mail submission or
  31for use with gitlink:git-am[1].
  32
  33Each output file is numbered sequentially from 1, and uses the
  34first line of the commit message (massaged for pathname safety) as
  35the filename. The names of the output files are printed to standard
  36output, unless the --stdout option is specified.
  37
  38If -o is specified, output files are created in <dir>.  Otherwise
  39they are created in the current working directory.
  40
  41If -n is specified, instead of "[PATCH] Subject", the first line
  42is formatted as "[PATCH n/m] Subject".
  43
  44If given --thread, git-format-patch will generate In-Reply-To and
  45References headers to make the second and subsequent patch mails appear
  46as replies to the first mail; this also generates a Message-Id header to
  47reference.
  48
  49OPTIONS
  50-------
  51include::diff-options.txt[]
  52
  53-<n>::
  54        Limits the number of patches to prepare.
  55
  56-o|--output-directory <dir>::
  57        Use <dir> to store the resulting files, instead of the
  58        current working directory.
  59
  60-n|--numbered::
  61        Name output in '[PATCH n/m]' format.
  62
  63--start-number <n>::
  64        Start numbering the patches at <n> instead of 1.
  65
  66-k|--keep-subject::
  67        Do not strip/add '[PATCH]' from the first line of the
  68        commit log message.
  69
  70-s|--signoff::
  71        Add `Signed-off-by:` line to the commit message, using
  72        the committer identity of yourself.
  73
  74--stdout::
  75        Print all commits to the standard output in mbox format,
  76        instead of creating a file for each one.
  77
  78--attach[=<boundary>]::
  79        Create multipart/mixed attachment, the first part of
  80        which is the commit message and the patch itself in the
  81        second part, with "Content-Disposition: attachment".
  82
  83--inline[=<boundary>]::
  84        Create multipart/mixed attachment, the first part of
  85        which is the commit message and the patch itself in the
  86        second part, with "Content-Disposition: inline".
  87
  88--thread::
  89        Add In-Reply-To and References headers to make the second and
  90        subsequent mails appear as replies to the first.  Also generates
  91        the Message-Id header to reference.
  92
  93--in-reply-to=Message-Id::
  94        Make the first mail (or all the mails with --no-thread) appear as a
  95        reply to the given Message-Id, which avoids breaking threads to
  96        provide a new patch series.
  97
  98--ignore-if-in-upstream::
  99        Do not include a patch that matches a commit in
 100        <until>..<since>.  This will examine all patches reachable
 101        from <since> but not from <until> and compare them with the
 102        patches being generated, and any patch that matches is
 103        ignored.
 104
 105--subject-prefix=<Subject-Prefix>::
 106        Instead of the standard '[PATCH]' prefix in the subject
 107        line, instead use '[<Subject-Prefix>]'. This
 108        allows for useful naming of a patch series, and can be
 109        combined with the --numbered option.
 110
 111--suffix=.<sfx>::
 112        Instead of using `.patch` as the suffix for generated
 113        filenames, use specifed suffix.  A common alternative is
 114        `--suffix=.txt`.
 115+
 116Note that you would need to include the leading dot `.` if you
 117want a filename like `0001-description-of-my-change.patch`, and
 118the first letter does not have to be a dot.  Leaving it empty would
 119not add any suffix.
 120
 121CONFIGURATION
 122-------------
 123You can specify extra mail header lines to be added to each
 124message in the repository configuration.  Also you can specify
 125the default suffix different from the built-in one:
 126
 127------------
 128[format]
 129        headers = "Organization: git-foo\n"
 130        suffix = .txt
 131------------
 132
 133
 134EXAMPLES
 135--------
 136
 137git-format-patch -k --stdout R1..R2 | git-am -3 -k::
 138        Extract commits between revisions R1 and R2, and apply
 139        them on top of the current branch using `git-am` to
 140        cherry-pick them.
 141
 142git-format-patch origin::
 143        Extract all commits which are in the current branch but
 144        not in the origin branch.  For each commit a separate file
 145        is created in the current directory.
 146
 147git-format-patch -M -B origin::
 148        The same as the previous one.  Additionally, it detects
 149        and handles renames and complete rewrites intelligently to
 150        produce a renaming patch.  A renaming patch reduces the
 151        amount of text output, and generally makes it easier to
 152        review it.  Note that the "patch" program does not
 153        understand renaming patches, so use it only when you know
 154        the recipient uses git to apply your patch.
 155
 156git-format-patch -3::
 157        Extract three topmost commits from the current branch
 158        and format them as e-mailable patches.
 159
 160See Also
 161--------
 162gitlink:git-am[1], gitlink:git-send-email[1]
 163
 164
 165Author
 166------
 167Written by Junio C Hamano <junkio@cox.net>
 168
 169Documentation
 170--------------
 171Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
 172
 173GIT
 174---
 175Part of the gitlink:git[7] suite
 176