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 Following bisection you may wish to configure, build and test perl at
460 commits identified by the bisection process. Sometimes, particularly
461 with older perls, "make" may fail during this process. In this case
462 you may be able to patch the source code at the older commit point. To
463 do so, please follow the suggestions provided in "Building perl at
464 older commits" in perlhack.
465
466 Topic branches and rewriting history
467 Individual committers should create topic branches under
468 yourname/some_descriptive_name:
469
470 % branch="$yourname/$some_descriptive_name"
471 % git checkout -b $branch
472 ... do local edits, commits etc ...
473 % git push origin -u $branch
474
475 Should you be stuck with an ancient version of git (prior to 1.7), then
476 "git push" will not have the "-u" switch, and you have to replace the
477 last step with the following sequence:
478
479 % git push origin $branch:refs/heads/$branch
480 % git config branch.$branch.remote origin
481 % git config branch.$branch.merge refs/heads/$branch
482
483 If you want to make changes to someone else's topic branch, you should
484 check with its creator before making any change to it.
485
486 You might sometimes find that the original author has edited the
487 branch's history. There are lots of good reasons for this. Sometimes,
488 an author might simply be rebasing the branch onto a newer source
489 point. Sometimes, an author might have found an error in an early
490 commit which they wanted to fix before merging the branch to blead.
491
492 Currently the master repository is configured to forbid non-fast-
493 forward merges. This means that the branches within can not be rebased
494 and pushed as a single step.
495
496 The only way you will ever be allowed to rebase or modify the history
497 of a pushed branch is to delete it and push it as a new branch under
498 the same name. Please think carefully about doing this. It may be
499 better to sequentially rename your branches so that it is easier for
500 others working with you to cherry-pick their local changes onto the new
501 version. (XXX: needs explanation).
502
503 If you want to rebase a personal topic branch, you will have to delete
504 your existing topic branch and push as a new version of it. You can do
505 this via the following formula (see the explanation about "refspec"'s
506 in the git push documentation for details) after you have rebased your
507 branch:
508
509 # first rebase
510 % git checkout $user/$topic
511 % git fetch
512 % git rebase origin/blead
513
514 # then "delete-and-push"
515 % git push origin :$user/$topic
516 % git push origin $user/$topic
517
518 NOTE: it is forbidden at the repository level to delete any of the
519 "primary" branches. That is any branch matching
520 "m!^(blead|maint|perl)!". Any attempt to do so will result in git
521 producing an error like this:
522
523 % git push origin :blead
524 *** It is forbidden to delete blead/maint branches in this repository
525 error: hooks/update exited with error code 1
526 error: hook declined to update refs/heads/blead
527 To ssh://perl5.git.perl.org/perl
528 ! [remote rejected] blead (hook declined)
529 error: failed to push some refs to 'ssh://perl5.git.perl.org/perl'
530
531 As a matter of policy we do not edit the history of the blead and
532 maint-* branches. If a typo (or worse) sneaks into a commit to blead or
533 maint-*, we'll fix it in another commit. The only types of updates
534 allowed on these branches are "fast-forwards", where all history is
535 preserved.
536
537 Annotated tags in the canonical perl.git repository will never be
538 deleted or modified. Think long and hard about whether you want to push
539 a local tag to perl.git before doing so. (Pushing simple tags is not
540 allowed.)
541
542 Grafts
543 The perl history contains one mistake which was not caught in the
544 conversion: a merge was recorded in the history between blead and
545 maint-5.10 where no merge actually occurred. Due to the nature of git,
546 this is now impossible to fix in the public repository. You can remove
547 this mis-merge locally by adding the following line to your
548 ".git/info/grafts" file:
549
550 296f12bbbbaa06de9be9d09d3dcf8f4528898a49 434946e0cb7a32589ed92d18008aaa1d88515930
551
552 It is particularly important to have this graft line if any bisecting
553 is done in the area of the "merge" in question.
554
556 Once you have write access, you will need to modify the URL for the
557 origin remote to enable pushing. Edit .git/config with the
558 git-config(1) command:
559
560 % git config remote.origin.url ssh://perl5.git.perl.org/perl.git
561
562 You can also set up your user name and e-mail address. Most people do
563 this once globally in their ~/.gitconfig by doing something like:
564
565 % git config --global user.name "AEvar Arnfjoerd` Bjarmason"
566 % git config --global user.email avarab@gmail.com
567
568 However, if you'd like to override that just for perl, execute
569 something like the following in perl:
570
571 % git config user.email avar@cpan.org
572
573 It is also possible to keep "origin" as a git remote, and add a new
574 remote for ssh access:
575
576 % git remote add camel perl5.git.perl.org:/perl.git
577
578 This allows you to update your local repository by pulling from
579 "origin", which is faster and doesn't require you to authenticate, and
580 to push your changes back with the "camel" remote:
581
582 % git fetch camel
583 % git push camel
584
585 The "fetch" command just updates the "camel" refs, as the objects
586 themselves should have been fetched when pulling from "origin".
587
588 Accepting a patch
589 If you have received a patch file generated using the above section,
590 you should try out the patch.
591
592 First we need to create a temporary new branch for these changes and
593 switch into it:
594
595 % git checkout -b experimental
596
597 Patches that were formatted by "git format-patch" are applied with "git
598 am":
599
600 % git am 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
601 Applying Rename Leon Brocard to Orange Brocard
602
603 Note that some UNIX mail systems can mess with text attachments
604 containing 'From '. This will fix them up:
605
606 % perl -pi -e's/^>From /From /' \
607 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
608
609 If just a raw diff is provided, it is also possible use this two-step
610 process:
611
612 % git apply bugfix.diff
613 % git commit -a -m "Some fixing" \
614 --author="That Guy <that.guy@internets.com>"
615
616 Now we can inspect the change:
617
618 % git show HEAD
619 commit b1b3dab48344cff6de4087efca3dbd63548ab5e2
620 Author: Leon Brocard <acme@astray.com>
621 Date: Fri Dec 19 17:02:59 2008 +0000
622
623 Rename Leon Brocard to Orange Brocard
624
625 diff --git a/AUTHORS b/AUTHORS
626 index 293dd70..722c93e 100644
627 --- a/AUTHORS
628 +++ b/AUTHORS
629 @@ -541,7 +541,7 @@ Lars Hecking <lhecking@nmrc.ucc.ie>
630 Laszlo Molnar <laszlo.molnar@eth.ericsson.se>
631 Leif Huhn <leif@hale.dkstat.com>
632 Len Johnson <lenjay@ibm.net>
633 -Leon Brocard <acme@astray.com>
634 +Orange Brocard <acme@astray.com>
635 Les Peters <lpeters@aol.net>
636 Lesley Binks <lesley.binks@gmail.com>
637 Lincoln D. Stein <lstein@cshl.org>
638
639 If you are a committer to Perl and you think the patch is good, you can
640 then merge it into blead then push it out to the main repository:
641
642 % git checkout blead
643 % git merge experimental
644 % git push origin blead
645
646 If you want to delete your temporary branch, you may do so with:
647
648 % git checkout blead
649 % git branch -d experimental
650 error: The branch 'experimental' is not an ancestor of your current
651 HEAD. If you are sure you want to delete it, run 'git branch -D
652 experimental'.
653 % git branch -D experimental
654 Deleted branch experimental.
655
656 Committing to blead
657 The 'blead' branch will become the next production release of Perl.
658
659 Before pushing any local change to blead, it's incredibly important
660 that you do a few things, lest other committers come after you with
661 pitchforks and torches:
662
663 · Make sure you have a good commit message. See "Commit message" in
664 perlhack for details.
665
666 · Run the test suite. You might not think that one typo fix would
667 break a test file. You'd be wrong. Here's an example of where not
668 running the suite caused problems. A patch was submitted that added
669 a couple of tests to an existing .t. It couldn't possibly affect
670 anything else, so no need to test beyond the single affected .t,
671 right? But, the submitter's email address had changed since the
672 last of their submissions, and this caused other tests to fail.
673 Running the test target given in the next item would have caught
674 this problem.
675
676 · If you don't run the full test suite, at least "make test_porting".
677 This will run basic sanity checks. To see which sanity checks, have
678 a look in t/porting.
679
680 · If you make any changes that affect miniperl or core routines that
681 have different code paths for miniperl, be sure to run "make
682 minitest". This will catch problems that even the full test suite
683 will not catch because it runs a subset of tests under miniperl
684 rather than perl.
685
686 On merging and rebasing
687 Simple, one-off commits pushed to the 'blead' branch should be simple
688 commits that apply cleanly. In other words, you should make sure your
689 work is committed against the current position of blead, so that you
690 can push back to the master repository without merging.
691
692 Sometimes, blead will move while you're building or testing your
693 changes. When this happens, your push will be rejected with a message
694 like this:
695
696 To ssh://perl5.git.perl.org/perl.git
697 ! [rejected] blead -> blead (non-fast-forward)
698 error: failed to push some refs to 'ssh://perl5.git.perl.org/perl.git'
699 To prevent you from losing history, non-fast-forward updates were
700 rejected Merge the remote changes (e.g. 'git pull') before pushing
701 again. See the 'Note about fast-forwards' section of 'git push --help'
702 for details.
703
704 When this happens, you can just rebase your work against the new
705 position of blead, like this (assuming your remote for the master
706 repository is "p5p"):
707
708 % git fetch p5p
709 % git rebase p5p/blead
710
711 You will see your commits being re-applied, and you will then be able
712 to push safely. More information about rebasing can be found in the
713 documentation for the git-rebase(1) command.
714
715 For larger sets of commits that only make sense together, or that would
716 benefit from a summary of the set's purpose, you should use a merge
717 commit. You should perform your work on a topic branch, which you
718 should regularly rebase against blead to ensure that your code is not
719 broken by blead moving. When you have finished your work, please
720 perform a final rebase and test. Linear history is something that gets
721 lost with every commit on blead, but a final rebase makes the history
722 linear again, making it easier for future maintainers to see what has
723 happened. Rebase as follows (assuming your work was on the branch
724 "committer/somework"):
725
726 % git checkout committer/somework
727 % git rebase blead
728
729 Then you can merge it into master like this:
730
731 % git checkout blead
732 % git merge --no-ff --no-commit committer/somework
733 % git commit -a
734
735 The switches above deserve explanation. "--no-ff" indicates that even
736 if all your work can be applied linearly against blead, a merge commit
737 should still be prepared. This ensures that all your work will be
738 shown as a side branch, with all its commits merged into the mainstream
739 blead by the merge commit.
740
741 "--no-commit" means that the merge commit will be prepared but not
742 committed. The commit is then actually performed when you run the next
743 command, which will bring up your editor to describe the commit.
744 Without "--no-commit", the commit would be made with nearly no useful
745 message, which would greatly diminish the value of the merge commit as
746 a placeholder for the work's description.
747
748 When describing the merge commit, explain the purpose of the branch,
749 and keep in mind that this description will probably be used by the
750 eventual release engineer when reviewing the next perldelta document.
751
752 Committing to maintenance versions
753 Maintenance versions should only be altered to add critical bug fixes,
754 see perlpolicy.
755
756 To commit to a maintenance version of perl, you need to create a local
757 tracking branch:
758
759 % git checkout --track -b maint-5.005 origin/maint-5.005
760
761 This creates a local branch named "maint-5.005", which tracks the
762 remote branch "origin/maint-5.005". Then you can pull, commit, merge
763 and push as before.
764
765 You can also cherry-pick commits from blead and another branch, by
766 using the "git cherry-pick" command. It is recommended to use the -x
767 option to "git cherry-pick" in order to record the SHA1 of the original
768 commit in the new commit message.
769
770 Before pushing any change to a maint version, make sure you've
771 satisfied the steps in "Committing to blead" above.
772
773 Merging from a branch via GitHub
774 While we don't encourage the submission of patches via GitHub, that
775 will still happen. Here is a guide to merging patches from a GitHub
776 repository.
777
778 % git remote add avar git://github.com/avar/perl.git
779 % git fetch avar
780
781 Now you can see the differences between the branch and blead:
782
783 % git diff avar/orange
784
785 And you can see the commits:
786
787 % git log avar/orange
788
789 If you approve of a specific commit, you can cherry pick it:
790
791 % git cherry-pick 0c24b290ae02b2ab3304f51d5e11e85eb3659eae
792
793 Or you could just merge the whole branch if you like it all:
794
795 % git merge avar/orange
796
797 And then push back to the repository:
798
799 % git push origin blead
800
801 Using a smoke-me branch to test changes
802 Sometimes a change affects code paths which you cannot test on the OSes
803 which are directly available to you and it would be wise to have users
804 on other OSes test the change before you commit it to blead.
805
806 Fortunately, there is a way to get your change smoke-tested on various
807 OSes: push it to a "smoke-me" branch and wait for certain automated
808 smoke-testers to report the results from their OSes. A "smoke-me"
809 branch is identified by the branch name: specifically, as seen on
810 perl5.git.perl.org it must be a local branch whose first name component
811 is precisely "smoke-me".
812
813 The procedure for doing this is roughly as follows (using the example
814 of of tonyc's smoke-me branch called win32stat):
815
816 First, make a local branch and switch to it:
817
818 % git checkout -b win32stat
819
820 Make some changes, build perl and test your changes, then commit them
821 to your local branch. Then push your local branch to a remote smoke-me
822 branch:
823
824 % git push origin win32stat:smoke-me/tonyc/win32stat
825
826 Now you can switch back to blead locally:
827
828 % git checkout blead
829
830 and continue working on other things while you wait a day or two,
831 keeping an eye on the results reported for your smoke-me branch at
832 <http://perl.develop-help.com/?b=smoke-me/tonyc/win32state>.
833
834 If all is well then update your blead branch:
835
836 % git pull
837
838 then checkout your smoke-me branch once more and rebase it on blead:
839
840 % git rebase blead win32stat
841
842 Now switch back to blead and merge your smoke-me branch into it:
843
844 % git checkout blead
845 % git merge win32stat
846
847 As described earlier, if there are many changes on your smoke-me branch
848 then you should prepare a merge commit in which to give an overview of
849 those changes by using the following command instead of the last
850 command above:
851
852 % git merge win32stat --no-ff --no-commit
853
854 You should now build perl and test your (merged) changes one last time
855 (ideally run the whole test suite, but failing that at least run the
856 t/porting/*.t tests) before pushing your changes as usual:
857
858 % git push origin blead
859
860 Finally, you should then delete the remote smoke-me branch:
861
862 % git push origin :smoke-me/tonyc/win32stat
863
864 (which is likely to produce a warning like this, which can be ignored:
865
866 remote: fatal: ambiguous argument
867 'refs/heads/smoke-me/tonyc/win32stat':
868 unknown revision or path not in the working tree.
869 remote: Use '--' to separate paths from revisions
870
871 ) and then delete your local branch:
872
873 % git branch -d win32stat
874
875 A note on camel and dromedary
876 The committers have SSH access to the two servers that serve
877 "perl5.git.perl.org". One is "perl5.git.perl.org" itself (camel), which
878 is the 'master' repository. The second one is
879 "users.perl5.git.perl.org" (dromedary), which can be used for general
880 testing and development. Dromedary syncs the git tree from camel every
881 few minutes, you should not push there. Both machines also have a full
882 CPAN mirror in /srv/CPAN, please use this. To share files with the
883 general public, dromedary serves your ~/public_html/ as
884 "<http://users.perl5.git.perl.org/~yourlogin/>"
885
886 These hosts have fairly strict firewalls to the outside. Outgoing, only
887 rsync, ssh and git are allowed. For http and ftp, you can use
888 <http://webproxy:3128> as proxy. Incoming, the firewall tries to detect
889 attacks and blocks IP addresses with suspicious activity. This
890 sometimes (but very rarely) has false positives and you might get
891 blocked. The quickest way to get unblocked is to notify the admins.
892
893 These two boxes are owned, hosted, and operated by booking.com. You can
894 reach the sysadmins in #p5p on irc.perl.org or via mail to
895 perl5-porters@perl.org <mailto:perl5-porters@perl.org>.
896
897
898
899perl v5.28.2 2018-11-01 PERLGIT(1)