1PERLGIT(1) Perl Programmers Reference Guide PERLGIT(1)
2
3
4
6 perlgit - Detailed information about git and the Perl repository
7
9 This document provides details on using git to develop Perl. If you are
10 just interested in working on a quick patch, see perlhack first. This
11 document is intended for people who are regular contributors to Perl,
12 including those with write access to the git repository.
13
15 All of Perl's source code is kept centrally in a Git repository at
16 perl5.git.perl.org.
17
18 You can make a read-only clone of the repository by running:
19
20 % git clone git://perl5.git.perl.org/perl.git perl
21
22 This uses the git protocol (port 9418).
23
24 If you cannot use the git protocol for firewall reasons, you can also
25 clone via http, though this is much slower:
26
27 % git clone http://perl5.git.perl.org/perl.git perl
28
30 Once you have changed into the repository directory, you can inspect
31 it. After a clone the repository will contain a single local branch,
32 which will be the current branch as well, as indicated by the asterisk.
33
34 % git branch
35 * blead
36
37 Using the -a switch to "branch" will also show the remote tracking
38 branches in the repository:
39
40 % git branch -a
41 * blead
42 origin/HEAD
43 origin/blead
44 ...
45
46 The branches that begin with "origin" correspond to the "git remote"
47 that you cloned from (which is named "origin"). Each branch on the
48 remote will be exactly tracked by these branches. You should NEVER do
49 work on these remote tracking branches. You only ever do work in a
50 local branch. Local branches can be configured to automerge (on pull)
51 from a designated remote tracking branch. This is the case with the
52 default branch "blead" which will be configured to merge from the
53 remote tracking branch "origin/blead".
54
55 You can see recent commits:
56
57 % git log
58
59 And pull new changes from the repository, and update your local
60 repository (must be clean first)
61
62 % git pull
63
64 Assuming we are on the branch "blead" immediately after a pull, this
65 command would be more or less equivalent to:
66
67 % git fetch
68 % git merge origin/blead
69
70 In fact if you want to update your local repository without touching
71 your working directory you do:
72
73 % git fetch
74
75 And if you want to update your remote-tracking branches for all defined
76 remotes simultaneously you can do
77
78 % git remote update
79
80 Neither of these last two commands will update your working directory,
81 however both will update the remote-tracking branches in your
82 repository.
83
84 To make a local branch of a remote branch:
85
86 % git checkout -b maint-5.10 origin/maint-5.10
87
88 To switch back to blead:
89
90 % git checkout blead
91
92 Finding out your status
93 The most common git command you will use will probably be
94
95 % git status
96
97 This command will produce as output a description of the current state
98 of the repository, including modified files and unignored untracked
99 files, and in addition it will show things like what files have been
100 staged for the next commit, and usually some useful information about
101 how to change things. For instance the following:
102
103 % git status
104 On branch blead
105 Your branch is ahead of 'origin/blead' by 1 commit.
106
107 Changes to be committed:
108 (use "git reset HEAD <file>..." to unstage)
109
110 modified: pod/perlgit.pod
111
112 Changes not staged for commit:
113 (use "git add <file>..." to update what will be committed)
114 (use "git checkout -- <file>..." to discard changes in working
115 directory)
116
117 modified: pod/perlgit.pod
118
119 Untracked files:
120 (use "git add <file>..." to include in what will be committed)
121
122 deliberate.untracked
123
124 This shows that there were changes to this document staged for commit,
125 and that there were further changes in the working directory not yet
126 staged. It also shows that there was an untracked file in the working
127 directory, and as you can see shows how to change all of this. It also
128 shows that there is one commit on the working branch "blead" which has
129 not been pushed to the "origin" remote yet. NOTE: This output is also
130 what you see as a template if you do not provide a message to "git
131 commit".
132
133 Patch workflow
134 First, please read perlhack for details on hacking the Perl core. That
135 document covers many details on how to create a good patch.
136
137 If you already have a Perl repository, you should ensure that you're on
138 the blead branch, and your repository is up to date:
139
140 % git checkout blead
141 % git pull
142
143 It's preferable to patch against the latest blead version, since this
144 is where new development occurs for all changes other than critical bug
145 fixes. Critical bug fix patches should be made against the relevant
146 maint branches, or should be submitted with a note indicating all the
147 branches where the fix should be applied.
148
149 Now that we have everything up to date, we need to create a temporary
150 new branch for these changes and switch into it:
151
152 % git checkout -b orange
153
154 which is the short form of
155
156 % git branch orange
157 % git checkout orange
158
159 Creating a topic branch makes it easier for the maintainers to rebase
160 or merge back into the master blead for a more linear history. If you
161 don't work on a topic branch the maintainer has to manually cherry pick
162 your changes onto blead before they can be applied.
163
164 That'll get you scolded on perl5-porters, so don't do that. Be Awesome.
165
166 Then make your changes. For example, if Leon Brocard changes his name
167 to Orange Brocard, we should change his name in the AUTHORS file:
168
169 % perl -pi -e 's{Leon Brocard}{Orange Brocard}' AUTHORS
170
171 You can see what files are changed:
172
173 % git status
174 On branch orange
175 Changes to be committed:
176 (use "git reset HEAD <file>..." to unstage)
177
178 modified: AUTHORS
179
180 And you can see the changes:
181
182 % git diff
183 diff --git a/AUTHORS b/AUTHORS
184 index 293dd70..722c93e 100644
185 --- a/AUTHORS
186 +++ b/AUTHORS
187 @@ -541,7 +541,7 @@ Lars Hecking <lhecking@nmrc.ucc.ie>
188 Laszlo Molnar <laszlo.molnar@eth.ericsson.se>
189 Leif Huhn <leif@hale.dkstat.com>
190 Len Johnson <lenjay@ibm.net>
191 -Leon Brocard <acme@astray.com>
192 +Orange Brocard <acme@astray.com>
193 Les Peters <lpeters@aol.net>
194 Lesley Binks <lesley.binks@gmail.com>
195 Lincoln D. Stein <lstein@cshl.org>
196
197 Now commit your change locally:
198
199 % git commit -a -m 'Rename Leon Brocard to Orange Brocard'
200 Created commit 6196c1d: Rename Leon Brocard to Orange Brocard
201 1 files changed, 1 insertions(+), 1 deletions(-)
202
203 The "-a" option is used to include all files that git tracks that you
204 have changed. If at this time, you only want to commit some of the
205 files you have worked on, you can omit the "-a" and use the command
206 "git add FILE ..." before doing the commit. "git add --interactive"
207 allows you to even just commit portions of files instead of all the
208 changes in them.
209
210 The "-m" option is used to specify the commit message. If you omit it,
211 git will open a text editor for you to compose the message
212 interactively. This is useful when the changes are more complex than
213 the sample given here, and, depending on the editor, to know that the
214 first line of the commit message doesn't exceed the 50 character legal
215 maximum.
216
217 Once you've finished writing your commit message and exited your
218 editor, git will write your change to disk and tell you something like
219 this:
220
221 Created commit daf8e63: explain git status and stuff about remotes
222 1 files changed, 83 insertions(+), 3 deletions(-)
223
224 If you re-run "git status", you should see something like this:
225
226 % git status
227 On branch orange
228 Untracked files:
229 (use "git add <file>..." to include in what will be committed)
230
231 deliberate.untracked
232
233 nothing added to commit but untracked files present (use "git add" to
234 track)
235
236 When in doubt, before you do anything else, check your status and read
237 it carefully, many questions are answered directly by the git status
238 output.
239
240 You can examine your last commit with:
241
242 % git show HEAD
243
244 and if you are not happy with either the description or the patch
245 itself you can fix it up by editing the files once more and then issue:
246
247 % git commit -a --amend
248
249 Now you should create a patch file for all your local changes:
250
251 % git format-patch -M blead..
252 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
253
254 Or for a lot of changes, e.g. from a topic branch:
255
256 % git format-patch --stdout -M blead.. > topic-branch-changes.patch
257
258 You should now send an email to perlbug@perl.org
259 <mailto:perlbug@perl.org> with a description of your changes, and
260 include this patch file as an attachment. In addition to being tracked
261 by RT, mail to perlbug will automatically be forwarded to perl5-porters
262 (with manual moderation, so please be patient). You should only send
263 patches to perl5-porters@perl.org <mailto:perl5-porters@perl.org>
264 directly if the patch is not ready to be applied, but intended for
265 discussion.
266
267 Please do not use git-send-email(1) to send your patch. See Sending
268 patch emails for more information.
269
270 If you want to delete your temporary branch, you may do so with:
271
272 % git checkout blead
273 % git branch -d orange
274 error: The branch 'orange' is not an ancestor of your current HEAD.
275 If you are sure you want to delete it, run 'git branch -D orange'.
276 % git branch -D orange
277 Deleted branch orange.
278
279 Committing your changes
280 Assuming that you'd like to commit all the changes you've made as a
281 single atomic unit, run this command:
282
283 % git commit -a
284
285 (That "-a" tells git to add every file you've changed to this commit.
286 New files aren't automatically added to your commit when you use
287 "commit -a" If you want to add files or to commit some, but not all of
288 your changes, have a look at the documentation for "git add".)
289
290 Git will start up your favorite text editor, so that you can craft a
291 commit message for your change. See "Commit message" in perlhack for
292 more information about what makes a good commit message.
293
294 Once you've finished writing your commit message and exited your
295 editor, git will write your change to disk and tell you something like
296 this:
297
298 Created commit daf8e63: explain git status and stuff about remotes
299 1 files changed, 83 insertions(+), 3 deletions(-)
300
301 If you re-run "git status", you should see something like this:
302
303 % git status
304 On branch blead
305 Your branch is ahead of 'origin/blead' by 2 commits.
306 (use "git push" to publish your local commits)
307 Untracked files:
308 (use "git add <file>..." to include in what will be committed)
309
310 deliberate.untracked
311
312 nothing added to commit but untracked files present (use "git add" to
313 track)
314
315 When in doubt, before you do anything else, check your status and read
316 it carefully, many questions are answered directly by the git status
317 output.
318
319 Sending patch emails
320 After you've generated your patch you should send it to
321 perlbug@perl.org <mailto:perlbug@perl.org> (as discussed in the
322 previous section) with a normal mail client as an attachment, along
323 with a description of the patch.
324
325 You must not use git-send-email(1) to send patches generated with
326 git-format-patch(1). The RT ticketing system living behind
327 perlbug@perl.org <mailto:perlbug@perl.org> does not respect the inline
328 contents of E-Mails, sending an inline patch to RT guarantees that your
329 patch will be destroyed.
330
331 Someone may download your patch from RT, which will result in the
332 subject (the first line of the commit message) being omitted. See RT
333 #74192 <https://rt.perl.org/Ticket/Display.html?id=74192> and commit
334 a4583001 <http://perl5.git.perl.org/perl.git/commitdiff/a4583001> for
335 an example. Alternatively someone may apply your patch from RT after it
336 arrived in their mailbox, by which time RT will have modified the
337 inline content of the message. See RT #74532
338 <https://rt.perl.org/Ticket/Display.html?id=74532> and commit f9bcfeac
339 <http://perl5.git.perl.org/perl.git/commitdiff/f9bcfeac> for a bad
340 example of this failure mode.
341
342 A note on derived files
343 Be aware that many files in the distribution are derivative--avoid
344 patching them, because git won't see the changes to them, and the build
345 process will overwrite them. Patch the originals instead. Most
346 utilities (like perldoc) are in this category, i.e. patch
347 utils/perldoc.PL rather than utils/perldoc. Similarly, don't create
348 patches for files under $src_root/ext from their copies found in
349 $install_root/lib. If you are unsure about the proper location of a
350 file that may have gotten copied while building the source
351 distribution, consult the MANIFEST.
352
353 Cleaning a working directory
354 The command "git clean" can with varying arguments be used as a
355 replacement for "make clean".
356
357 To reset your working directory to a pristine condition you can do:
358
359 % git clean -dxf
360
361 However, be aware this will delete ALL untracked content. You can use
362
363 % git clean -Xf
364
365 to remove all ignored untracked files, such as build and test
366 byproduct, but leave any manually created files alone.
367
368 If you only want to cancel some uncommitted edits, you can use "git
369 checkout" and give it a list of files to be reverted, or "git checkout
370 -f" to revert them all.
371
372 If you want to cancel one or several commits, you can use "git reset".
373
374 Bisecting
375 "git" provides a built-in way to determine which commit should be
376 blamed for introducing a given bug. "git bisect" performs a binary
377 search of history to locate the first failing commit. It is fast,
378 powerful and flexible, but requires some setup and to automate the
379 process an auxiliary shell script is needed.
380
381 The core provides a wrapper program, Porting/bisect.pl, which attempts
382 to simplify as much as possible, making bisecting as simple as running
383 a Perl one-liner. For example, if you want to know when this became an
384 error:
385
386 perl -e 'my $a := 2'
387
388 you simply run this:
389
390 .../Porting/bisect.pl -e 'my $a := 2;'
391
392 Using Porting/bisect.pl, with one command (and no other files) it's
393 easy to find out
394
395 · Which commit caused this example code to break?
396
397 · Which commit caused this example code to start working?
398
399 · Which commit added the first file to match this regex?
400
401 · Which commit removed the last file to match this regex?
402
403 usually without needing to know which versions of perl to use as start
404 and end revisions, as Porting/bisect.pl automatically searches to find
405 the earliest stable version for which the test case passes. Run
406 "Porting/bisect.pl --help" for the full documentation, including how to
407 set the "Configure" and build time options.
408
409 If you require more flexibility than Porting/bisect.pl has to offer,
410 you'll need to run "git bisect" yourself. It's most useful to use "git
411 bisect run" to automate the building and testing of perl revisions. For
412 this you'll need a shell script for "git" to call to test a particular
413 revision. An example script is Porting/bisect-example.sh, which you
414 should copy outside of the repository, as the bisect process will reset
415 the state to a clean checkout as it runs. The instructions below assume
416 that you copied it as ~/run and then edited it as appropriate.
417
418 You first enter in bisect mode with:
419
420 % git bisect start
421
422 For example, if the bug is present on "HEAD" but wasn't in 5.10.0,
423 "git" will learn about this when you enter:
424
425 % git bisect bad
426 % git bisect good perl-5.10.0
427 Bisecting: 853 revisions left to test after this
428
429 This results in checking out the median commit between "HEAD" and
430 "perl-5.10.0". You can then run the bisecting process with:
431
432 % git bisect run ~/run
433
434 When the first bad commit is isolated, "git bisect" will tell you so:
435
436 ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5 is first bad commit
437 commit ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5
438 Author: Dave Mitchell <davem@fdisolutions.com>
439 Date: Sat Feb 9 14:56:23 2008 +0000
440
441 [perl #49472] Attributes + Unknown Error
442 ...
443
444 bisect run success
445
446 You can peek into the bisecting process with "git bisect log" and "git
447 bisect visualize". "git bisect reset" will get you out of bisect mode.
448
449 Please note that the first "good" state must be an ancestor of the
450 first "bad" state. If you want to search for the commit that solved
451 some bug, you have to negate your test case (i.e. exit with 1 if OK and
452 0 if not) and still mark the lower bound as "good" and the upper as
453 "bad". The "first bad commit" has then to be understood as the "first
454 commit where the bug is solved".
455
456 "git help bisect" has much more information on how you can tweak your
457 binary searches.
458
459 Topic branches and rewriting history
460 Individual committers should create topic branches under
461 yourname/some_descriptive_name:
462
463 % branch="$yourname/$some_descriptive_name"
464 % git checkout -b $branch
465 ... do local edits, commits etc ...
466 % git push origin -u $branch
467
468 Should you be stuck with an ancient version of git (prior to 1.7), then
469 "git push" will not have the "-u" switch, and you have to replace the
470 last step with the following sequence:
471
472 % git push origin $branch:refs/heads/$branch
473 % git config branch.$branch.remote origin
474 % git config branch.$branch.merge refs/heads/$branch
475
476 If you want to make changes to someone else's topic branch, you should
477 check with its creator before making any change to it.
478
479 You might sometimes find that the original author has edited the
480 branch's history. There are lots of good reasons for this. Sometimes,
481 an author might simply be rebasing the branch onto a newer source
482 point. Sometimes, an author might have found an error in an early
483 commit which they wanted to fix before merging the branch to blead.
484
485 Currently the master repository is configured to forbid non-fast-
486 forward merges. This means that the branches within can not be rebased
487 and pushed as a single step.
488
489 The only way you will ever be allowed to rebase or modify the history
490 of a pushed branch is to delete it and push it as a new branch under
491 the same name. Please think carefully about doing this. It may be
492 better to sequentially rename your branches so that it is easier for
493 others working with you to cherry-pick their local changes onto the new
494 version. (XXX: needs explanation).
495
496 If you want to rebase a personal topic branch, you will have to delete
497 your existing topic branch and push as a new version of it. You can do
498 this via the following formula (see the explanation about "refspec"'s
499 in the git push documentation for details) after you have rebased your
500 branch:
501
502 # first rebase
503 % git checkout $user/$topic
504 % git fetch
505 % git rebase origin/blead
506
507 # then "delete-and-push"
508 % git push origin :$user/$topic
509 % git push origin $user/$topic
510
511 NOTE: it is forbidden at the repository level to delete any of the
512 "primary" branches. That is any branch matching
513 "m!^(blead|maint|perl)!". Any attempt to do so will result in git
514 producing an error like this:
515
516 % git push origin :blead
517 *** It is forbidden to delete blead/maint branches in this repository
518 error: hooks/update exited with error code 1
519 error: hook declined to update refs/heads/blead
520 To ssh://perl5.git.perl.org/perl
521 ! [remote rejected] blead (hook declined)
522 error: failed to push some refs to 'ssh://perl5.git.perl.org/perl'
523
524 As a matter of policy we do not edit the history of the blead and
525 maint-* branches. If a typo (or worse) sneaks into a commit to blead or
526 maint-*, we'll fix it in another commit. The only types of updates
527 allowed on these branches are "fast-forwards", where all history is
528 preserved.
529
530 Annotated tags in the canonical perl.git repository will never be
531 deleted or modified. Think long and hard about whether you want to push
532 a local tag to perl.git before doing so. (Pushing simple tags is not
533 allowed.)
534
535 Grafts
536 The perl history contains one mistake which was not caught in the
537 conversion: a merge was recorded in the history between blead and
538 maint-5.10 where no merge actually occurred. Due to the nature of git,
539 this is now impossible to fix in the public repository. You can remove
540 this mis-merge locally by adding the following line to your
541 ".git/info/grafts" file:
542
543 296f12bbbbaa06de9be9d09d3dcf8f4528898a49 434946e0cb7a32589ed92d18008aaa1d88515930
544
545 It is particularly important to have this graft line if any bisecting
546 is done in the area of the "merge" in question.
547
549 Once you have write access, you will need to modify the URL for the
550 origin remote to enable pushing. Edit .git/config with the
551 git-config(1) command:
552
553 % git config remote.origin.url ssh://perl5.git.perl.org/perl.git
554
555 You can also set up your user name and e-mail address. Most people do
556 this once globally in their ~/.gitconfig by doing something like:
557
558 % git config --global user.name "AEvar Arnfjoerd` Bjarmason"
559 % git config --global user.email avarab@gmail.com
560
561 However, if you'd like to override that just for perl, execute
562 something like the following in perl:
563
564 % git config user.email avar@cpan.org
565
566 It is also possible to keep "origin" as a git remote, and add a new
567 remote for ssh access:
568
569 % git remote add camel perl5.git.perl.org:/perl.git
570
571 This allows you to update your local repository by pulling from
572 "origin", which is faster and doesn't require you to authenticate, and
573 to push your changes back with the "camel" remote:
574
575 % git fetch camel
576 % git push camel
577
578 The "fetch" command just updates the "camel" refs, as the objects
579 themselves should have been fetched when pulling from "origin".
580
581 Accepting a patch
582 If you have received a patch file generated using the above section,
583 you should try out the patch.
584
585 First we need to create a temporary new branch for these changes and
586 switch into it:
587
588 % git checkout -b experimental
589
590 Patches that were formatted by "git format-patch" are applied with "git
591 am":
592
593 % git am 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
594 Applying Rename Leon Brocard to Orange Brocard
595
596 Note that some UNIX mail systems can mess with text attachments
597 containing 'From '. This will fix them up:
598
599 % perl -pi -e's/^>From /From /' \
600 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
601
602 If just a raw diff is provided, it is also possible use this two-step
603 process:
604
605 % git apply bugfix.diff
606 % git commit -a -m "Some fixing" \
607 --author="That Guy <that.guy@internets.com>"
608
609 Now we can inspect the change:
610
611 % git show HEAD
612 commit b1b3dab48344cff6de4087efca3dbd63548ab5e2
613 Author: Leon Brocard <acme@astray.com>
614 Date: Fri Dec 19 17:02:59 2008 +0000
615
616 Rename Leon Brocard to Orange Brocard
617
618 diff --git a/AUTHORS b/AUTHORS
619 index 293dd70..722c93e 100644
620 --- a/AUTHORS
621 +++ b/AUTHORS
622 @@ -541,7 +541,7 @@ Lars Hecking <lhecking@nmrc.ucc.ie>
623 Laszlo Molnar <laszlo.molnar@eth.ericsson.se>
624 Leif Huhn <leif@hale.dkstat.com>
625 Len Johnson <lenjay@ibm.net>
626 -Leon Brocard <acme@astray.com>
627 +Orange Brocard <acme@astray.com>
628 Les Peters <lpeters@aol.net>
629 Lesley Binks <lesley.binks@gmail.com>
630 Lincoln D. Stein <lstein@cshl.org>
631
632 If you are a committer to Perl and you think the patch is good, you can
633 then merge it into blead then push it out to the main repository:
634
635 % git checkout blead
636 % git merge experimental
637 % git push origin blead
638
639 If you want to delete your temporary branch, you may do so with:
640
641 % git checkout blead
642 % git branch -d experimental
643 error: The branch 'experimental' is not an ancestor of your current
644 HEAD. If you are sure you want to delete it, run 'git branch -D
645 experimental'.
646 % git branch -D experimental
647 Deleted branch experimental.
648
649 Committing to blead
650 The 'blead' branch will become the next production release of Perl.
651
652 Before pushing any local change to blead, it's incredibly important
653 that you do a few things, lest other committers come after you with
654 pitchforks and torches:
655
656 · Make sure you have a good commit message. See "Commit message" in
657 perlhack for details.
658
659 · Run the test suite. You might not think that one typo fix would
660 break a test file. You'd be wrong. Here's an example of where not
661 running the suite caused problems. A patch was submitted that added
662 a couple of tests to an existing .t. It couldn't possibly affect
663 anything else, so no need to test beyond the single affected .t,
664 right? But, the submitter's email address had changed since the
665 last of their submissions, and this caused other tests to fail.
666 Running the test target given in the next item would have caught
667 this problem.
668
669 · If you don't run the full test suite, at least "make test_porting".
670 This will run basic sanity checks. To see which sanity checks, have
671 a look in t/porting.
672
673 · If you make any changes that affect miniperl or core routines that
674 have different code paths for miniperl, be sure to run "make
675 minitest". This will catch problems that even the full test suite
676 will not catch because it runs a subset of tests under miniperl
677 rather than perl.
678
679 On merging and rebasing
680 Simple, one-off commits pushed to the 'blead' branch should be simple
681 commits that apply cleanly. In other words, you should make sure your
682 work is committed against the current position of blead, so that you
683 can push back to the master repository without merging.
684
685 Sometimes, blead will move while you're building or testing your
686 changes. When this happens, your push will be rejected with a message
687 like this:
688
689 To ssh://perl5.git.perl.org/perl.git
690 ! [rejected] blead -> blead (non-fast-forward)
691 error: failed to push some refs to 'ssh://perl5.git.perl.org/perl.git'
692 To prevent you from losing history, non-fast-forward updates were
693 rejected Merge the remote changes (e.g. 'git pull') before pushing
694 again. See the 'Note about fast-forwards' section of 'git push --help'
695 for details.
696
697 When this happens, you can just rebase your work against the new
698 position of blead, like this (assuming your remote for the master
699 repository is "p5p"):
700
701 % git fetch p5p
702 % git rebase p5p/blead
703
704 You will see your commits being re-applied, and you will then be able
705 to push safely. More information about rebasing can be found in the
706 documentation for the git-rebase(1) command.
707
708 For larger sets of commits that only make sense together, or that would
709 benefit from a summary of the set's purpose, you should use a merge
710 commit. You should perform your work on a topic branch, which you
711 should regularly rebase against blead to ensure that your code is not
712 broken by blead moving. When you have finished your work, please
713 perform a final rebase and test. Linear history is something that gets
714 lost with every commit on blead, but a final rebase makes the history
715 linear again, making it easier for future maintainers to see what has
716 happened. Rebase as follows (assuming your work was on the branch
717 "committer/somework"):
718
719 % git checkout committer/somework
720 % git rebase blead
721
722 Then you can merge it into master like this:
723
724 % git checkout blead
725 % git merge --no-ff --no-commit committer/somework
726 % git commit -a
727
728 The switches above deserve explanation. "--no-ff" indicates that even
729 if all your work can be applied linearly against blead, a merge commit
730 should still be prepared. This ensures that all your work will be
731 shown as a side branch, with all its commits merged into the mainstream
732 blead by the merge commit.
733
734 "--no-commit" means that the merge commit will be prepared but not
735 committed. The commit is then actually performed when you run the next
736 command, which will bring up your editor to describe the commit.
737 Without "--no-commit", the commit would be made with nearly no useful
738 message, which would greatly diminish the value of the merge commit as
739 a placeholder for the work's description.
740
741 When describing the merge commit, explain the purpose of the branch,
742 and keep in mind that this description will probably be used by the
743 eventual release engineer when reviewing the next perldelta document.
744
745 Committing to maintenance versions
746 Maintenance versions should only be altered to add critical bug fixes,
747 see perlpolicy.
748
749 To commit to a maintenance version of perl, you need to create a local
750 tracking branch:
751
752 % git checkout --track -b maint-5.005 origin/maint-5.005
753
754 This creates a local branch named "maint-5.005", which tracks the
755 remote branch "origin/maint-5.005". Then you can pull, commit, merge
756 and push as before.
757
758 You can also cherry-pick commits from blead and another branch, by
759 using the "git cherry-pick" command. It is recommended to use the -x
760 option to "git cherry-pick" in order to record the SHA1 of the original
761 commit in the new commit message.
762
763 Before pushing any change to a maint version, make sure you've
764 satisfied the steps in "Committing to blead" above.
765
766 Merging from a branch via GitHub
767 While we don't encourage the submission of patches via GitHub, that
768 will still happen. Here is a guide to merging patches from a GitHub
769 repository.
770
771 % git remote add avar git://github.com/avar/perl.git
772 % git fetch avar
773
774 Now you can see the differences between the branch and blead:
775
776 % git diff avar/orange
777
778 And you can see the commits:
779
780 % git log avar/orange
781
782 If you approve of a specific commit, you can cherry pick it:
783
784 % git cherry-pick 0c24b290ae02b2ab3304f51d5e11e85eb3659eae
785
786 Or you could just merge the whole branch if you like it all:
787
788 % git merge avar/orange
789
790 And then push back to the repository:
791
792 % git push origin blead
793
794 Using a smoke-me branch to test changes
795 Sometimes a change affects code paths which you cannot test on the OSes
796 which are directly available to you and it would be wise to have users
797 on other OSes test the change before you commit it to blead.
798
799 Fortunately, there is a way to get your change smoke-tested on various
800 OSes: push it to a "smoke-me" branch and wait for certain automated
801 smoke-testers to report the results from their OSes.
802
803 The procedure for doing this is roughly as follows (using the example
804 of of tonyc's smoke-me branch called win32stat):
805
806 First, make a local branch and switch to it:
807
808 % git checkout -b win32stat
809
810 Make some changes, build perl and test your changes, then commit them
811 to your local branch. Then push your local branch to a remote smoke-me
812 branch:
813
814 % git push origin win32stat:smoke-me/tonyc/win32stat
815
816 Now you can switch back to blead locally:
817
818 % git checkout blead
819
820 and continue working on other things while you wait a day or two,
821 keeping an eye on the results reported for your smoke-me branch at
822 <http://perl.develop-help.com/?b=smoke-me/tonyc/win32state>.
823
824 If all is well then update your blead branch:
825
826 % git pull
827
828 then checkout your smoke-me branch once more and rebase it on blead:
829
830 % git rebase blead win32stat
831
832 Now switch back to blead and merge your smoke-me branch into it:
833
834 % git checkout blead
835 % git merge win32stat
836
837 As described earlier, if there are many changes on your smoke-me branch
838 then you should prepare a merge commit in which to give an overview of
839 those changes by using the following command instead of the last
840 command above:
841
842 % git merge win32stat --no-ff --no-commit
843
844 You should now build perl and test your (merged) changes one last time
845 (ideally run the whole test suite, but failing that at least run the
846 t/porting/*.t tests) before pushing your changes as usual:
847
848 % git push origin blead
849
850 Finally, you should then delete the remote smoke-me branch:
851
852 % git push origin :smoke-me/tonyc/win32stat
853
854 (which is likely to produce a warning like this, which can be ignored:
855
856 remote: fatal: ambiguous argument
857 'refs/heads/smoke-me/tonyc/win32stat':
858 unknown revision or path not in the working tree.
859 remote: Use '--' to separate paths from revisions
860
861 ) and then delete your local branch:
862
863 % git branch -d win32stat
864
865 A note on camel and dromedary
866 The committers have SSH access to the two servers that serve
867 "perl5.git.perl.org". One is "perl5.git.perl.org" itself (camel), which
868 is the 'master' repository. The second one is
869 "users.perl5.git.perl.org" (dromedary), which can be used for general
870 testing and development. Dromedary syncs the git tree from camel every
871 few minutes, you should not push there. Both machines also have a full
872 CPAN mirror in /srv/CPAN, please use this. To share files with the
873 general public, dromedary serves your ~/public_html/ as
874 "<http://users.perl5.git.perl.org/~yourlogin/>"
875
876 These hosts have fairly strict firewalls to the outside. Outgoing, only
877 rsync, ssh and git are allowed. For http and ftp, you can use
878 <http://webproxy:3128> as proxy. Incoming, the firewall tries to detect
879 attacks and blocks IP addresses with suspicious activity. This
880 sometimes (but very rarely) has false positives and you might get
881 blocked. The quickest way to get unblocked is to notify the admins.
882
883 These two boxes are owned, hosted, and operated by booking.com. You can
884 reach the sysadmins in #p5p on irc.perl.org or via mail to
885 perl5-porters@perl.org <mailto:perl5-porters@perl.org>.
886
887
888
889perl v5.26.3 2018-03-23 PERLGIT(1)