1
- Checklist (and a short version for the impatient):
2
-
3
- Commits:
4
-
5
- - make commits of logical units
6
- - check for unnecessary whitespace with "git diff --check"
7
- before committing
8
- - do not check in commented out code or unneeded files
9
- - the first line of the commit message should be a short
10
- description (50 characters is the soft limit, see DISCUSSION
11
- in git-commit(1)), and should skip the full stop
12
- - it is also conventional in most cases to prefix the
13
- first line with "area: " where the area is a filename
14
- or identifier for the general area of the code being
15
- modified, e.g.
16
- . archive: ustar header checksum is computed unsigned
17
- . git-cherry-pick.txt: clarify the use of revision range notation
18
- (if in doubt which identifier to use, run "git log --no-merges"
19
- on the files you are modifying to see the current conventions)
20
- - the body should provide a meaningful commit message, which:
21
- . explains the problem the change tries to solve, iow, what
22
- is wrong with the current code without the change.
23
- . justifies the way the change solves the problem, iow, why
24
- the result with the change is better.
25
- . alternate solutions considered but discarded, if any.
26
- - describe changes in imperative mood, e.g. "make xyzzy do frotz"
27
- instead of "[This patch] makes xyzzy do frotz" or "[I] changed
28
- xyzzy to do frotz", as if you are giving orders to the codebase
29
- to change its behaviour.
30
- - try to make sure your explanation can be understood without
31
- external resources. Instead of giving a URL to a mailing list
32
- archive, summarize the relevant points of the discussion.
33
- - add a "Signed-off-by: Your Name <
[email protected] >" line to the
34
- commit message (or just use the option "-s" when committing)
35
- to confirm that you agree to the Developer's Certificate of Origin
36
- - make sure that you have tests for the bug you are fixing
37
- - make sure that the test suite passes after your commit
38
-
39
- Patch:
40
-
41
- - use "git format-patch -M" to create the patch
42
- - do not PGP sign your patch
43
- - do not attach your patch, but read in the mail
44
- body, unless you cannot teach your mailer to
45
- leave the formatting of the patch alone.
46
- - be careful doing cut & paste into your mailer, not to
47
- corrupt whitespaces.
48
- - provide additional information (which is unsuitable for
49
- the commit message) between the "---" and the diffstat
50
- - if you change, add, or remove a command line option or
51
- make some other user interface change, the associated
52
- documentation should be updated as well.
53
- - if your name is not writable in ASCII, make sure that
54
- you send off a message in the correct encoding.
55
- - send the patch to the list (
[email protected] ) and the
56
- maintainer (
[email protected] ) if (and only if) the patch
57
- is ready for inclusion. If you use git-send-email(1),
58
- please test it first by sending email to yourself.
59
- - see below for instructions specific to your mailer
60
-
61
- Long version:
62
-
63
- I started reading over the SubmittingPatches document for Linux
64
- kernel, primarily because I wanted to have a document similar to
65
- it for the core GIT to make sure people understand what they are
66
- doing when they write "Signed-off-by" line.
67
-
68
- But the patch submission requirements are a lot more relaxed
69
- here on the technical/contents front, because the core GIT is
70
- thousand times smaller ;-). So here is only the relevant bits.
1
+ Here are some guidelines for people who want to contribute their code
2
+ to this software.
71
3
72
4
(0) Decide what to base your work on.
73
5
@@ -94,6 +26,10 @@ change is relevant to.
94
26
wait until some of the dependent topics graduate to 'master', and
95
27
rebase your work.
96
28
29
+ - Some parts of the system have dedicated maintainers with their own
30
+ repositories (see the section "Subsystems" below). Changes to
31
+ these parts should be based on their trees.
32
+
97
33
To find the tip of a topic branch, run "git log --first-parent
98
34
master..pu" and look for the merge commit. The second parent of this
99
35
commit is the tip of the topic branch.
@@ -121,36 +57,81 @@ change, the approach taken by the change, and if relevant how this
121
57
differs substantially from the prior version, are all good things
122
58
to have.
123
59
60
+ Make sure that you have tests for the bug you are fixing.
61
+
62
+ When adding a new feature, make sure that you have new tests to show
63
+ the feature triggers the new behaviour when it should, and to show the
64
+ feature does not trigger when it shouldn't. Also make sure that the
65
+ test suite passes after your commit. Do not forget to update the
66
+ documentation to describe the updated behaviour.
67
+
124
68
Oh, another thing. I am picky about whitespaces. Make sure your
125
69
changes do not trigger errors with the sample pre-commit hook shipped
126
70
in templates/hooks--pre-commit. To help ensure this does not happen,
127
71
run git diff --check on your changes before you commit.
128
72
129
73
130
- (2) Generate your patch using git tools out of your commits.
74
+ (2) Describe your changes well.
75
+
76
+ The first line of the commit message should be a short description (50
77
+ characters is the soft limit, see DISCUSSION in git-commit(1)), and
78
+ should skip the full stop. It is also conventional in most cases to
79
+ prefix the first line with "area: " where the area is a filename or
80
+ identifier for the general area of the code being modified, e.g.
81
+
82
+ . archive: ustar header checksum is computed unsigned
83
+ . git-cherry-pick.txt: clarify the use of revision range notation
84
+
85
+ If in doubt which identifier to use, run "git log --no-merges" on the
86
+ files you are modifying to see the current conventions.
87
+
88
+ The body should provide a meaningful commit message, which:
89
+
90
+ . explains the problem the change tries to solve, iow, what is wrong
91
+ with the current code without the change.
92
+
93
+ . justifies the way the change solves the problem, iow, why the
94
+ result with the change is better.
95
+
96
+ . alternate solutions considered but discarded, if any.
97
+
98
+ Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
99
+ instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
100
+ to do frotz", as if you are giving orders to the codebase to change
101
+ its behaviour. Try to make sure your explanation can be understood
102
+ without external resources. Instead of giving a URL to a mailing list
103
+ archive, summarize the relevant points of the discussion.
104
+
105
+
106
+ (3) Generate your patch using git tools out of your commits.
131
107
132
108
git based diff tools generate unidiff which is the preferred format.
133
109
134
110
You do not have to be afraid to use -M option to "git diff" or
135
111
"git format-patch", if your patch involves file renames. The
136
112
receiving end can handle them just fine.
137
113
138
- Please make sure your patch does not include any extra files
139
- which do not belong in a patch submission. Make sure to review
114
+ Please make sure your patch does not add commented out debugging code,
115
+ or include any extra files which do not relate to what your patch
116
+ is trying to achieve. Make sure to review
140
117
your patch after generating it, to ensure accuracy. Before
141
118
sending out, please make sure it cleanly applies to the "master"
142
119
branch head. If you are preparing a work based on "next" branch,
143
120
that is fine, but please mark it as such.
144
121
145
122
146
- (3 ) Sending your patches.
123
+ (4 ) Sending your patches.
147
124
148
125
People on the git mailing list need to be able to read and
149
126
comment on the changes you are submitting. It is important for
150
127
a developer to be able to "quote" your changes, using standard
151
128
e-mail tools, so that they may comment on specific portions of
152
129
your code. For this reason, all patches should be submitted
153
- "inline". WARNING: Be wary of your MUAs word-wrap
130
+ "inline". If your log message (including your name on the
131
+ Signed-off-by line) is not writable in ASCII, make sure that
132
+ you send off a message in the correct encoding.
133
+
134
+ WARNING: Be wary of your MUAs word-wrap
154
135
corrupting your patch. Do not cut-n-paste your patch; you can
155
136
lose tabs that way if you are not careful.
156
137
@@ -203,19 +184,25 @@ patch, format it as "multipart/signed", not a text/plain message
203
184
that starts with '-----BEGIN PGP SIGNED MESSAGE-----'. That is
204
185
not a text/plain, it's something else.
205
186
206
- Unless your patch is a very trivial and an obviously correct one,
207
- first send it with "To:" set to the mailing list, with "cc:" listing
187
+ Send your patch with "To:" set to the mailing list, with "cc:" listing
208
188
people who are involved in the area you are touching (the output from
209
189
"git blame $path" and "git shortlog --no-merges $path" would help to
210
- identify them), to solicit comments and reviews. After the list
211
- reached a consensus that it is a good idea to apply the patch, re-send
212
- it with "To:" set to the maintainer and optionally "cc:" the list for
213
- inclusion. Do not forget to add trailers such as "Acked-by:",
214
- "Reviewed-by:" and "Tested-by:" after your "Signed-off-by:" line as
215
- necessary.
190
+ identify them), to solicit comments and reviews.
216
191
192
+ After the list reached a consensus that it is a good idea to apply the
193
+ patch, re-send it with "To:" set to the maintainer [*1*] and "cc:" the
194
+ list [*2*] for inclusion.
217
195
218
- (4) Sign your work
196
+ Do not forget to add trailers such as "Acked-by:", "Reviewed-by:" and
197
+ "Tested-by:" lines as necessary to credit people who helped your
198
+ patch.
199
+
200
+ [Addresses]
201
+ *1* The current maintainer:
[email protected]
202
+ *2* The mailing list:
[email protected]
203
+
204
+
205
+ (5) Sign your work
219
206
220
207
To improve tracking of who did what, we've borrowed the
221
208
"sign-off" procedure from the Linux kernel project on patches
@@ -285,6 +272,26 @@ If you like, you can put extra tags at the end:
285
272
You can also create your own tag or use one that's in common usage
286
273
such as "Thanks-to:", "Based-on-patch-by:", or "Mentored-by:".
287
274
275
+ ------------------------------------------------
276
+ Subsystems with dedicated maintainers
277
+
278
+ Some parts of the system have dedicated maintainers with their own
279
+ repositories.
280
+
281
+ - git-gui/ comes from git-gui project, maintained by Pat Thoyts:
282
+
283
+ git://repo.or.cz/git-gui.git
284
+
285
+ - gitk-git/ comes from Paul Mackerras's gitk project:
286
+
287
+ git://ozlabs.org/~paulus/gitk
288
+
289
+ - po/ comes from the localization coordinator, Jiang Xin:
290
+
291
+ https://github.com/git-l10n/git-po/
292
+
293
+ Patches to these parts should be based on their trees.
294
+
288
295
------------------------------------------------
289
296
An ideal patch flow
290
297
0 commit comments