1Checklist
2
3(and a short version for the impatient):
4
5Commits:
6
7* make sure your work applies cleanly to branch master, it is not the default
8  branch. `git checkout * master`, you are welcome to run tests from
9  build/master to avoid needing Dist::Zilla
10* make commits of logical units
11* check for unnecessary whitespace with "git diff --check" before committing
12* do not check in commented out code or unneeded files
13* the first line of the commit message should be a short description and
14  should skip the full stop
15* the body should provide a meaningful commit message, which:
16	* uses the imperative, present tense: "change", not "changed" or "changes".
17	* includes motivation for the change, and contrasts its implementation with
18	  previous behaviour
19* if you want your work included in the main repository, add a "Signed-off-by:
20  Your Name <you@example.com>" line to the commit message (or just use the
21  option "-s" when committing) to confirm that you agree to the Developer's
22  Certificate of Origin
23* make sure that you have tests for the bug you are fixing
24* make sure that the test suite passes after your commit. This distribution
25  is built with Dist::Zilla ensure that running `dzil test` passes. You are
26  responsible for ensuring that generated, hand written and author tests pass.
27
28Patch:
29
30* if you change, add, or remove any features or make some other user
31  interface change, the associated documentation should be updated as well.
32* if your name is not writable in ASCII, make sure that you send the
33  patch in the correct encoding.
34
35Long version:
36
37I started reading over the SubmittingPatches document for git,
38primarily because I wanted to have a document similar to it for
39my projects to make sure people understand what they are doing
40when they write "Signed-off-by" line.
41
42But the patch submission requirements are a lot more relaxed
43here on the technical/contents front, because my projects are
44thousand times smaller ;-).  So here is only the relevant bits.
45
46
47(0) Decide what to base your work on.
48
49In general, always base your work on the oldest branch that your
50change is relevant to.
51
52* A bugfix should be based on 'maint' in general. If the bug is not
53present in 'maint', base it on 'master'. For a bug that's not yet
54in 'master', find the topic that introduces the regression, and
55base your work on the tip of the topic. If a 'maint' branch is not present
56base it on master.
57
58* A new feature should be based on 'master' in general. If the new
59feature depends on a topic that is in 'pu', but not in 'master', base your
60work on the tip of that topic.
61
62* Corrections and enhancements to a topic not yet in 'master' should be
63based on the tip of that topic. If the topic has not been merged to 'next',
64it's alright to add a note to squash minor corrections into the series.
65
66* In the exceptional case that a new feature depends on several topics
67not in 'master', start working on 'next' or 'pu' privately and send out
68patches for discussion. Before the final merge, you may have to wait until
69some of the dependent topics graduate to 'master', and rebase your work.
70
71To find the tip of a topic branch, run "git log --first-parent
72master..pu" and look for the merge commit. The second parent of this
73commit is the tip of the topic branch.
74
75
76(1) Make separate commits for logically separate changes.
77
78Unless your patch is really trivial, you should not be sending
79out a patch that was generated between your working tree and
80your commit head.  Instead, always make a commit with complete
81commit message and generate a series of patches from your
82repository.  It is a good discipline.
83
84Describe the technical detail of the change(s).
85
86If your description starts to get too long, that's a sign that you
87probably need to split up your commit to finer grained pieces.
88That being said, patches which plainly describe the things that
89help reviewers check the patch, and future maintainers understand
90the code, are the most beautiful patches.  Descriptions that summarise
91the point in the subject well, and describe the motivation for the
92change, the approach taken by the change, and if relevant how this
93differs substantially from the prior version, can be found on Usenet
94archives back into the late 80's.  Consider it like good Netiquette,
95but for code.
96
97Oh, another thing.  I am picky about whitespaces.  Make sure your
98changes do not trigger errors with the sample pre-commit hook shipped
99in templates/hooks--pre-commit.  To help ensure this does not happen,
100run git diff --check on your changes before you commit.
101
102
103(2) Generate your patch using git tools out of your commits.
104
105git based diff tools (git, Cogito, and StGIT included) generate
106unidiff which is the preferred format.
107
108You do not have to be afraid to use -M option to "git diff" or
109"git format-patch", if your patch involves file renames.  The
110receiving end can handle them just fine.
111
112Please make sure your patch does not include any extra files
113which do not belong in a patch submission.  Make sure to review
114your patch after generating it, to ensure accuracy.  Before
115sending out, please make sure it cleanly applies to the "master"
116branch head.  If you are preparing a work based on "next" branch,
117that is fine, but please mark it as such.
118
119(4) Sign your work
120
121To improve tracking of who did what, we've borrowed the
122"sign-off" procedure from the Linux kernel project on patches
123that are being emailed around.  Although this project is a lot
124smaller it is a good discipline to follow it.
125
126The sign-off is a simple line at the end of the explanation for
127the patch, which certifies that you wrote it or otherwise have
128the right to pass it on as a open-source patch.  The rules are
129pretty simple: if you can certify the below:
130
131        Developer's Certificate of Origin 1.1
132
133        By making a contribution to this project, I certify that:
134
135        (a) The contribution was created in whole or in part by me and I
136            have the right to submit it under the open source license
137            indicated in the file; or
138
139        (b) The contribution is based upon previous work that, to the best
140            of my knowledge, is covered under an appropriate open source
141            license and I have the right under that license to submit that
142            work with modifications, whether created in whole or in part
143            by me, under the same open source license (unless I am
144            permitted to submit under a different license), as indicated
145            in the file; or
146
147        (c) The contribution was provided directly to me by some other
148            person who certified (a), (b) or (c) and I have not modified
149            it.
150
151        (d) I understand and agree that this project and the contribution
152            are public and that a record of the contribution (including all
153            personal information I submit with it, including my sign-off) is
154            maintained indefinitely and may be redistributed consistent with
155            this project or the open source license(s) involved.
156
157then you just add a line saying
158
159	Signed-off-by: Random J Developer <random@developer.example.org>
160
161This line can be automatically added by git if you run the git-commit
162command with the -s option.
163
164Notice that you can place your own Signed-off-by: line when
165forwarding somebody else's patch with the above rules for
166D-C-O.  Indeed you are encouraged to do so.
167
168Also notice that a real name is used in the Signed-off-by: line. Please
169don't hide your real name.
170
171Some people also put extra tags at the end.
172
173"Acked-by:" says that the patch was reviewed by the person who
174is more familiar with the issues and the area the patch attempts
175to modify.  "Tested-by:" says the patch was tested by the person
176and found to have the desired effect.
177
178
179An ideal patch flow
180
181Here is an ideal patch flow for this project the current maintainer
182suggests to the contributors:
183
1840. You come up with an itch.  You code it up.
1851. Send it to the bug tracker and cc people who may need to know about
186   the change.
187
188   The people who may need to know are the ones whose
189   code you are butchering.  These people happen to be the ones who are most
190   likely to be knowledgeable enough to help you, but they have no obligation to
191   help you (i.e. you ask for help, don't demand).  "git log -p --
192   $area_you_are_modifying" would help you find out who they are.
193
1942. You get comments and suggestions for improvements.  You may even
195   get them in a "on top of your change" patch form.
196
1973. Polish, refine, and re-send to the the people who spend their
198   time to improve your patch.  Go back to step (2).
199
2004. A topic branch is created with the patch and is merged to 'next',
201   and cooked further and eventually graduates to 'master'.
202
203In any time between the (2)-(3) cycle, the maintainer may pick it up
204from the list and queue it to 'pu', in order to make it easier for
205people play with it without having to pick up and apply the patch to
206their trees themselves.
207
208
209Know the status of your patch after submission
210
211* You can use Git itself to find out when your patch is merged in
212master. 'git pull --rebase' will automatically skip already-applied
213patches, and will let you know. This works only if you rebase on top
214of the branch in which your patch has been merged (i.e. it will not
215tell you if your patch is merged in pu if you rebase on top of
216master).
217