]> git.ipfire.org Git - thirdparty/util-linux.git/blame - Documentation/howto-pull-request.txt
Wall: Fix terminal flag usage
[thirdparty/util-linux.git] / Documentation / howto-pull-request.txt
CommitLineData
5de50f26
SK
1Introduction
2------------
3
4These instructions are wrote to contributors who tend to send lots of
5changes. The basics from howto-contribute.txt file are assumed to be
6read and understood by the time this file becomes useful.
7
8
9Setup
10-----
11
121. Find a git server that can be reached from anywhere in internet
13anonymously. Github is for example a popular choice.
14
3c560686 152. Create your own util-linux contributor repository, and push an upstream
5de50f26
SK
16clone to there.
17
183. In these instructions the upstream remote repository is called
19'origin' and the 'yourgit' is the contributor repo.
20
21cd ~/projects
22git clone git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git
23cd util-linux
24git remote add yourgit git@github.com:yourlogin/util-linux.git
25git push yourgit
26
27
28Branches
29--------
30
0f749c8f
KZ
311. The name of your branch isn't crucial, but if you intend to contribute
32regularly, it's beneficial to establish a naming convention that works well for
33you. For instance, consider prefixing your branch name with the subsystem's
34name, such as blkid, libmount, etc.
5de50f26 35
0f749c8f
KZ
362. Avoid using the 'master' branch for your contributions. The 'master' branch
37should be reserved for staying synchronized with the upstream repository.
5de50f26 38
0f749c8f 393. Once you've completed your work, push your branch to your remote Git server.
5de50f26
SK
40
41git checkout master
42git branch textual
43# spent here most of the effort
ca8a129a 44git push yourgit textual:textual
5de50f26
SK
45
465. Do not worry if you used stupid-and-wrong branch name, it can be fixed
47before submission.
48
49git branch -m stupid-and-wrong brilliant
50git push yourgit brilliant:brilliant :stupid-and-wrong
51
52
53Stay up to date
54---------------
55
561. Ensure you have the latest from all remote repositories.
57
582. Merge upstream 'master' branch if needed to your local 'master'.
59
603. Rebase your working contribution branches.
61
624. Push the changes to 'yourgit'.
63
64git fetch --all
65git log --graph --decorate --pretty=oneline --abbrev-commit --all
66
675. If you notice upstream has changed while you were busy with your
68changes rebase on top of the master, but before that:
69
706. Push a backup of your branch 'textual' to 'yourgit', then
71
72git checkout master
73git merge origin/master
74git checkout textual
75git rebase master
76
77If rebase reports conflicts fix the conflicts. In case the rebase
78conflict is difficult to fix rebase --abort is good option, or recover
79from 'yourgit', either way there is some serious re-work ahead with the
80change set.
81
827. Assuming rebase went fine push the latest to 'yourgit'.
83
84git push yourgit master:master
85git push yourgit --force textual:textual
86
87The contributor branch tends to need --force every now and then, don't be
88afraid using it.
89
908. Push error with master branch
91
92If 'master' needs --force then something is really messed up. In that
93case it is probably the wise to abandon(*) local clone, and start all
94over from cloning upstream again. Once the upstream is cloned add again
95'yourgit' remote and
96
97git push --mirror yourgit
98
99But be WARNED. The --mirror will nuke all of your stuff had in
100'yourgit', that can cause data loss. (*)So don't remove the local clone,
101just move the directory to broken repos area.
102
103
104Sending pull request
105--------------------
106
1071. When you are happy with your changes sleep over night. This is not a
108speed competition, and for some reason looking the changes the next day
109often makes one to realize how things could be improved. The best this
110way you avoid changing the changes (that is always confusing).
111
1122. Check the next day the changes compile without errors or warnings, and
113that regression tests run fine.
114
115make clean &&
116make -j3 &&
117make check
118
119Notice that regression tests will not cover all possible cases, so you
120most likely need to use the commands, features, and fixes you did
121manually.
122
1233. If you need to change something.
124
125git rebase -i master
126# change something
127git push -f yourgit textual:textual
128
9c2b43b1
KZ
1294. You have two ways how to send your pull request:
130
0f749c8f 1314.1 Github pull request (recommended)
9c2b43b1 132
0f749c8f
KZ
133This is recommended way for your changes. All you need is to press "pull
134request" button on GitHub.
9c2b43b1 135
0f749c8f 1364.2. Send your work to the mailing list (optional)
9c2b43b1
KZ
137
138Assuming the changes look good send them to mail list. Yes, the all
5de50f26
SK
139of them! Sending pull request with github is not visible for project
140contributors, and they will not have change to review your changes.
141
142Sending only the pull request, i.e., not each patch, to mail-list is also
143bad. Nothing is as good as seeing the changes as they are, and being
144able to find them from with your favourite web search engine from
145mail-list archive. Obviously the pull request content does not get
146indexed, and that is why it is worse.
147
148git format-patch --cover-letter master..textual
871ba058 149git request-pull upstream/master https://github.com/yourlogin/util-linux.git textual > tempfile
5de50f26
SK
150
151Take from the 'tempfile' the header:
152
153----------------------------------------------------------------
154The following changes since commit 17bf9c1c39b4f35163ec5c443b8bbd5857386ddd:
155
156 ipcrm: fix usage (2015-01-06 11:55:21 +0100)
157
158are available in the git repository at:
159
871ba058 160 https://github.com/yourlogin/util-linux.git textual
5de50f26
SK
161----------------------------------------------------------------
162
163and copy paste it to 0000-cover-letter.patch file somewhere near 'BLURB
164HERE'. Rest of the 'request-pull' output should be ignored.
165
166In same go fix the Subject: line to have reasonable description, for
167example
168
169Subject: [PATCH 00/15] pull: various textual improvements
170
171
172Feedback and resubmissions
173--------------------------
174
1751. Since you sent each patch to mail-list you can see which ones got to
176be responded. In case the feedback will result in changes to the
177submission then rebase, perform the changes, and push again to your
178remote.
179
180# you probably should use 'Stay up to date' instructions now
181git checkout textual
182git rebase master -i
183# edit something
184git add files
185git commit --amend
186# Add 'Reviewed-by:', 'Tested-by:', 'Signed-off-by:', 'Reference:', and
187# other lines near signoff when needed. Attributing the reviewers is a
188# virtue, try to do it.
189git rebase --continue
190git push -f yourgit textual:textual
191
1922. Send a message to mail-list that the submitted change has changed, and
193that the new version can be found from
194
195https://github.com/yourlogin/util-linux/commit/0123456789abcdef0123456789abcdef01234567
196
1973. There is no need to update the pull request cover letter. The project
198maintainer has done enough of this stuff to know what to do.
199
200
201Repository maintenance
202----------------------
203
2041. When your remote branch is merged, or you got final reject, it is time
205to clean it up.
206
207git branch textual -d
208git push yourgit :textual
209
2102. If you have other contributor repositories configured you may also
211want to clean up the branches the others are done with.
212
213for I in $(git remote); do
214 echo "pruning: $I"
215 git remote prune $I
216done
217
2183. When all of your contributions are processed you should tidy up the
219git's guts.
220
221git reflog expire --all
222git gc --aggressive --prune=now
223
224Warning. That tidying is not good idea while you are actively working
225with the change set. You never know when you need to recover something
226from reflog, so keep that option available until you know the reflog is
227not needed.
228
229
230More branches, on top of branches, on top of ...
231------------------------------------------------
232
233Here is a one way of laying out multiple branches.
234
235git log --graph --decorate --pretty=oneline --abbrev-commit --all
236* 13bfff3 (HEAD, docs-update) docs: small improvements to howto-contribute.txt
237* 5435d28 (sami/more, more) more: do not call fileno() for std{in,out,err} streams
238* 3e1ac04 more: remove unnecessary braces
239* c19f31c more: check open(3) return value
240* 651ec1b more: move skipping forewards to a function from command()
241* bf0c2a7 more: move skipping backwards to a function from command()
242* 53a438d more: move editor execution to a function from command()
243* b11628b more: move runtime usage output away from command()
244* 6cab04e more: avoid long else segment in prbuf()
245* a2d9fbb more: remove 'register' keywords
246* c6b2d29 more: remove pointless functions
247* b41fe34 more: remove function like preprocessor defines
248* 1aaa1ce more: use paths.h to find bourne shell and vi editor
249* 016a019 more: return is statement, not a function
250* ff7019a more: remove dead code and useless comments
251* 1705c76 more: add struct more_control and remove global variables
252* 3ad4868 more: reorder includes, declarations, and global variables
253* 7220e9d more: remove function declarations - BRANCH STATUS: WORK IN PROGRESS
254* 04b9544 (sami/script) script: add noreturn function attributes
255* e7b8d50 script: use gettime_monotonic() to get timing file timestamps
256* 11289d2 script: use correct input type, move comment, and so on
257* 524e3e7 script: replace strftime() workaround with CFLAGS = -Wno-format-y2k
258* 0465e7f script: move do_io() content to small functions
259* 751edca script: add 'Script started' line always to capture file
260* f831657 script: remove io vs signal race
261* eefc1b7 script: merge doinput() and output() functions to do_io()
262* 9eba044 script: use poll() rather than select()
263* a6f04ef script: use signalfd() to catch signals
264* 4a86d9c script: add struct script_control and remove global variables
265* d1cf19c script: remove function prototypes
266* 6a7dce9 (sami/2015wk00) fsck.minix: fix segmentation fault
267* 5e3bcf7 lslocks: fix type warning
268* 3904423 maint: fix shadow declarations
269* 17bf9c1 (upstream/master, sami/master, kzgh/master, master) ipcrm: fix usage
270[...]
271
272The above gives a hint to maintainer what is the preferred merge order.
273The branches '2015wk00' and 'script' are ready to be merged, and they
274were sent to mail-list.
275
276The 'more' branch was not submitted at the time of writing this text.
277Mark-up the branch is not ready is clearly marked in the commit subject,
278that will need some rebaseing to before submission.
279
280Good order of the branches is;
281
2821. First the minor & safe changes.
2832. Then the ready but less certain stuff.
2843. Followed by work-in-progress.
285
286If you go down this route you will get used to typing a lot of
287
288git rebase previous-branch
289git push -f yourgit branch:branch
290
291Alternatively rebase each branch on top of origin/master, which is not
292quite as good. How do you ensure your own changes are not in conflict
293with each other? And there is no hint of preferred merging order.