Documentation / git-format-patch.txton commit Merge branch 'jc/diff-numstat' (f73a5e8)
   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] [--attach] [--thread]
  13                   [-s | --signoff] [--diff-options] [--start-number <n>]
  14                   [--in-reply-to=Message-Id]
  15                   <since>[..<until>]
  16
  17DESCRIPTION
  18-----------
  19
  20Prepare each commit between <since> and <until> with its patch in
  21one file per commit, formatted to resemble UNIX mailbox format.
  22If ..<until> is not specified, the head of the current working
  23tree is implied.
  24
  25The output of this command is convenient for e-mail submission or
  26for use with gitlink:git-am[1].
  27
  28Each output file is numbered sequentially from 1, and uses the
  29first line of the commit message (massaged for pathname safety) as
  30the filename. The names of the output files are printed to standard
  31output, unless the --stdout option is specified.
  32
  33If -o is specified, output files are created in <dir>.  Otherwise
  34they are created in the current working directory.
  35
  36If -n is specified, instead of "[PATCH] Subject", the first line
  37is formatted as "[PATCH n/m] Subject".
  38
  39If given --thread, git-format-patch will generate In-Reply-To and
  40References headers to make the second and subsequent patch mails appear
  41as replies to the first mail; this also generates a Message-Id header to
  42reference.
  43
  44OPTIONS
  45-------
  46-o|--output-directory <dir>::
  47        Use <dir> to store the resulting files, instead of the
  48        current working directory.
  49
  50-n|--numbered::
  51        Name output in '[PATCH n/m]' format.
  52
  53--start-number <n>::
  54        Start numbering the patches at <n> instead of 1.
  55
  56-k|--keep-subject::
  57        Do not strip/add '[PATCH]' from the first line of the
  58        commit log message.
  59
  60-s|--signoff::
  61        Add `Signed-off-by:` line to the commit message, using
  62        the committer identity of yourself.
  63
  64--stdout::
  65        Print all commits to the standard output in mbox format,
  66        instead of creating a file for each one.
  67
  68--attach::
  69        Create attachments instead of inlining patches.
  70
  71--thread::
  72        Add In-Reply-To and References headers to make the second and
  73        subsequent mails appear as replies to the first.  Also generates
  74        the Message-Id header to reference.
  75
  76--in-reply-to=Message-Id::
  77        Make the first mail (or all the mails with --no-thread) appear as a
  78        reply to the given Message-Id, which avoids breaking threads to
  79        provide a new patch series.
  80
  81CONFIGURATION
  82-------------
  83You can specify extra mail header lines to be added to each
  84message in the repository configuration as follows:
  85
  86[format]
  87        headers = "Organization: git-foo\n"
  88
  89
  90EXAMPLES
  91--------
  92
  93git-format-patch -k --stdout R1..R2 | git-am -3 -k::
  94        Extract commits between revisions R1 and R2, and apply
  95        them on top of the current branch using `git-am` to
  96        cherry-pick them.
  97
  98git-format-patch origin::
  99        Extract all commits which are in the current branch but
 100        not in the origin branch.  For each commit a separate file
 101        is created in the current directory.
 102
 103git-format-patch -M -B origin::
 104        The same as the previous one.  Additionally, it detects
 105        and handles renames and complete rewrites intelligently to
 106        produce a renaming patch.  A renaming patch reduces the
 107        amount of text output, and generally makes it easier to
 108        review it.  Note that the "patch" program does not
 109        understand renaming patches, so use it only when you know
 110        the recipient uses git to apply your patch.
 111
 112
 113See Also
 114--------
 115gitlink:git-am[1], gitlink:git-send-email[1]
 116
 117
 118Author
 119------
 120Written by Junio C Hamano <junkio@cox.net>
 121
 122Documentation
 123--------------
 124Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
 125
 126GIT
 127---
 128Part of the gitlink:git[7] suite
 129