Documentation / SubmittingPatcheson commit Merge with master. (d430042)
   1I started reading over the SubmittingPatches document for Linux
   2kernel, primarily because I wanted to have a document similar to
   3it for the core GIT to make sure people understand what they are
   4doing when they write "Signed-off-by" line.
   5
   6But the patch submission requirements are a lot more relaxed
   7here, because the core GIT is thousand times smaller ;-).  So
   8here is only the relevant bits.
   9
  10
  11(1) Make separate commits for logically separate changes.
  12
  13Unless your patch is really trivial, you should not be sending
  14out a patch that was generated between your working tree and
  15your commit head.  Instead, always make a commit with complete
  16commit message and generate a series of patches from your
  17repository.  It is a good discipline.
  18
  19Describe the technical detail of the change(s).
  20
  21If your description starts to get long, that's a sign that you
  22probably need to split up your commit to finer grained pieces.
  23
  24
  25(2) Generate your patch using git/cogito out of your commits.
  26
  27git diff tools generate unidiff which is the preferred format.
  28You do not have to be afraid to use -M option to "git diff" or
  29"git format-patch", if your patch involves file renames.  The
  30receiving end can handle them just fine.
  31
  32Please make sure your patch does not include any extra files
  33which do not belong in a patch submission.  Make sure to review
  34your patch after generating it, to ensure accuracy.  Before
  35sending out, please make sure it cleanly applies to the "master"
  36branch head.
  37
  38
  39(3) Sending your patches.
  40
  41People on the git mailing list needs to be able to read and
  42comment on the changes you are submitting.  It is important for
  43a developer to be able to "quote" your changes, using standard
  44e-mail tools, so that they may comment on specific portions of
  45your code.  For this reason, all patches should be submitting
  46e-mail "inline".  WARNING: Be wary of your MUAs word-wrap
  47corrupting your patch.  Do not cut-n-paste your patch.
  48
  49It is common convention to prefix your subject line with
  50[PATCH].  This lets people easily distinguish patches from other
  51e-mail discussions.
  52
  53"git format-patch" command follows the best current practice to
  54format the body of an e-mail message.  At the beginning of the
  55patch should come your commit message, ending with the
  56Signed-off-by: lines, and a line that consists of three dashes,
  57followed by the diffstat information and the patch itself.  If
  58you are forwarding a patch from somebody else, optionally, at
  59the beginning of the e-mail message just before the commit
  60message starts, you can put a "From: " line to name that person.
  61
  62You often want to add additional explanation about the patch,
  63other than the commit message itself.  Place such "cover letter"
  64material between the three dash lines and the diffstat.
  65
  66Do not attach the patch as a MIME attachment, compressed or not.
  67Do not let your e-mail client send quoted-printable.  Many
  68popular e-mail applications will not always transmit a MIME
  69attachment as plain text, making it impossible to comment on
  70your code.  A MIME attachment also takes a bit more time to
  71process.  This does not decrease the likelihood of your
  72MIME-attached change being accepted, but it makes it more likely
  73that it will be postponed.
  74
  75Exception:  If your mailer is mangling patches then someone may ask
  76you to re-send them using MIME.
  77
  78Note that your maintainer does not subscribe to the git mailing
  79list (he reads it via mail-to-news gateway).  If your patch is
  80for discussion first, send it "To:" the mailing list, and
  81optoinally "cc:" him.  If it is trivially correct or after list
  82discussion reached consensus, send it "To:" the maintainer and
  83optionally "cc:" the list.
  84
  85
  86(6) Sign your work
  87
  88To improve tracking of who did what, we've borrowed the
  89"sign-off" procedure from the Linux kernel project on patches
  90that are being emailed around.  Although core GIT is a lot
  91smaller project it is a good discipline to follow it.
  92
  93The sign-off is a simple line at the end of the explanation for
  94the patch, which certifies that you wrote it or otherwise have
  95the right to pass it on as a open-source patch.  The rules are
  96pretty simple: if you can certify the below:
  97
  98        Developer's Certificate of Origin 1.1
  99
 100        By making a contribution to this project, I certify that:
 101
 102        (a) The contribution was created in whole or in part by me and I
 103            have the right to submit it under the open source license
 104            indicated in the file; or
 105
 106        (b) The contribution is based upon previous work that, to the best
 107            of my knowledge, is covered under an appropriate open source
 108            license and I have the right under that license to submit that
 109            work with modifications, whether created in whole or in part
 110            by me, under the same open source license (unless I am
 111            permitted to submit under a different license), as indicated
 112            in the file; or
 113
 114        (c) The contribution was provided directly to me by some other
 115            person who certified (a), (b) or (c) and I have not modified
 116            it.
 117
 118        (d) I understand and agree that this project and the contribution
 119            are public and that a record of the contribution (including all
 120            personal information I submit with it, including my sign-off) is
 121            maintained indefinitely and may be redistributed consistent with
 122            this project or the open source license(s) involved.
 123
 124then you just add a line saying
 125
 126        Signed-off-by: Random J Developer <random@developer.example.org>
 127
 128Some people also put extra tags at the end.  They'll just be ignored for
 129now, but you can do this to mark internal company procedures or just
 130point out some special detail about the sign-off.