1PERLGIT(1)             Perl Programmers Reference Guide             PERLGIT(1)
2
3
4

NAME

6       perlgit - Detailed information about git and the Perl repository
7

DESCRIPTION

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

CLONING THE REPOSITORY

15       All of Perl's source code is kept centrally in a Git repository at
16       github.com.
17
18       You can make a read-only clone of the repository by running:
19
20         % git clone git@github.com:Perl/perl5.git perl
21
22       If you cannot use that for firewall reasons, you can also clone via
23       http:
24
25         % git clone https://github.com/Perl/perl5.git perl
26

WORKING WITH THE REPOSITORY

28       Once you have changed into the repository directory, you can inspect
29       it. After a clone the repository will contain a single local branch,
30       which will be the current branch as well, as indicated by the asterisk.
31
32         % git branch
33         * blead
34
35       Using the -a switch to "branch" will also show the remote tracking
36       branches in the repository:
37
38         % git branch -a
39         * blead
40           origin/HEAD
41           origin/blead
42         ...
43
44       The branches that begin with "origin" correspond to the "git remote"
45       that you cloned from (which is named "origin"). Each branch on the
46       remote will be exactly tracked by these branches. You should NEVER do
47       work on these remote tracking branches. You only ever do work in a
48       local branch. Local branches can be configured to automerge (on pull)
49       from a designated remote tracking branch. This is the case with the
50       default branch "blead" which will be configured to merge from the
51       remote tracking branch "origin/blead".
52
53       You can see recent commits:
54
55         % git log
56
57       And pull new changes from the repository, and update your local
58       repository (must be clean first)
59
60         % git pull
61
62       Assuming we are on the branch "blead" immediately after a pull, this
63       command would be more or less equivalent to:
64
65         % git fetch
66         % git merge origin/blead
67
68       In fact if you want to update your local repository without touching
69       your working directory you do:
70
71         % git fetch
72
73       And if you want to update your remote-tracking branches for all defined
74       remotes simultaneously you can do
75
76         % git remote update
77
78       Neither of these last two commands will update your working directory,
79       however both will update the remote-tracking branches in your
80       repository.
81
82       To make a local branch of a remote branch:
83
84         % git checkout -b maint-5.10 origin/maint-5.10
85
86       To switch back to blead:
87
88         % git checkout blead
89
90   Finding out your status
91       The most common git command you will use will probably be
92
93         % git status
94
95       This command will produce as output a description of the current state
96       of the repository, including modified files and unignored untracked
97       files, and in addition it will show things like what files have been
98       staged for the next commit, and usually some useful information about
99       how to change things. For instance the following:
100
101        % git status
102        On branch blead
103        Your branch is ahead of 'origin/blead' by 1 commit.
104
105        Changes to be committed:
106          (use "git reset HEAD <file>..." to unstage)
107
108              modified:   pod/perlgit.pod
109
110        Changes not staged for commit:
111          (use "git add <file>..." to update what will be committed)
112          (use "git checkout -- <file>..." to discard changes in working
113                                                                     directory)
114
115              modified:   pod/perlgit.pod
116
117        Untracked files:
118          (use "git add <file>..." to include in what will be committed)
119
120              deliberate.untracked
121
122       This shows that there were changes to this document staged for commit,
123       and that there were further changes in the working directory not yet
124       staged. It also shows that there was an untracked file in the working
125       directory, and as you can see shows how to change all of this. It also
126       shows that there is one commit on the working branch "blead" which has
127       not been pushed to the "origin" remote yet. NOTE: This output is also
128       what you see as a template if you do not provide a message to "git
129       commit".
130
131   Patch workflow
132       First, please read perlhack for details on hacking the Perl core.  That
133       document covers many details on how to create a good patch.
134
135       If you already have a Perl repository, you should ensure that you're on
136       the blead branch, and your repository is up to date:
137
138         % git checkout blead
139         % git pull
140
141       It's preferable to patch against the latest blead version, since this
142       is where new development occurs for all changes other than critical bug
143       fixes. Critical bug fix patches should be made against the relevant
144       maint branches, or should be submitted with a note indicating all the
145       branches where the fix should be applied.
146
147       Now that we have everything up to date, we need to create a temporary
148       new branch for these changes and switch into it:
149
150         % git checkout -b orange
151
152       which is the short form of
153
154         % git branch orange
155         % git checkout orange
156
157       Creating a topic branch makes it easier for the maintainers to rebase
158       or merge back into the master blead for a more linear history. If you
159       don't work on a topic branch the maintainer has to manually cherry pick
160       your changes onto blead before they can be applied.
161
162       That'll get you scolded on perl5-porters, so don't do that. Be Awesome.
163
164       Then make your changes. For example, if Leon Brocard changes his name
165       to Orange Brocard, we should change his name in the AUTHORS file:
166
167         % perl -pi -e 's{Leon Brocard}{Orange Brocard}' AUTHORS
168
169       You can see what files are changed:
170
171         % git status
172         On branch orange
173         Changes to be committed:
174           (use "git reset HEAD <file>..." to unstage)
175
176            modified:   AUTHORS
177
178       And you can see the changes:
179
180        % git diff
181        diff --git a/AUTHORS b/AUTHORS
182        index 293dd70..722c93e 100644
183        --- a/AUTHORS
184        +++ b/AUTHORS
185        @@ -541,7 +541,7 @@    Lars Hecking              <lhecking@nmrc.ucc.ie>
186         Laszlo Molnar                  <laszlo.molnar@eth.ericsson.se>
187         Leif Huhn                      <leif@hale.dkstat.com>
188         Len Johnson                    <lenjay@ibm.net>
189        -Leon Brocard                   <acme@astray.com>
190        +Orange Brocard                 <acme@astray.com>
191         Les Peters                     <lpeters@aol.net>
192         Lesley Binks                   <lesley.binks@gmail.com>
193         Lincoln D. Stein               <lstein@cshl.org>
194
195       Now commit your change locally:
196
197        % git commit -a -m 'Rename Leon Brocard to Orange Brocard'
198        Created commit 6196c1d: Rename Leon Brocard to Orange Brocard
199         1 files changed, 1 insertions(+), 1 deletions(-)
200
201       The "-a" option is used to include all files that git tracks that you
202       have changed. If at this time, you only want to commit some of the
203       files you have worked on, you can omit the "-a" and use the command
204       "git add FILE ..." before doing the commit. "git add --interactive"
205       allows you to even just commit portions of files instead of all the
206       changes in them.
207
208       The "-m" option is used to specify the commit message. If you omit it,
209       git will open a text editor for you to compose the message
210       interactively. This is useful when the changes are more complex than
211       the sample given here, and, depending on the editor, to know that the
212       first line of the commit message doesn't exceed the 50 character legal
213       maximum. See "Commit message" in perlhack for more information about
214       what makes a good commit message.
215
216       Once you've finished writing your commit message and exited your
217       editor, git will write your change to disk and tell you something like
218       this:
219
220        Created commit daf8e63: explain git status and stuff about remotes
221         1 files changed, 83 insertions(+), 3 deletions(-)
222
223       If you re-run "git status", you should see something like this:
224
225        % git status
226        On branch orange
227        Untracked files:
228          (use "git add <file>..." to include in what will be committed)
229
230              deliberate.untracked
231
232        nothing added to commit but untracked files present (use "git add" to
233                                                                         track)
234
235       When in doubt, before you do anything else, check your status and read
236       it carefully, many questions are answered directly by the git status
237       output.
238
239       You can examine your last commit with:
240
241         % git show HEAD
242
243       and if you are not happy with either the description or the patch
244       itself you can fix it up by editing the files once more and then issue:
245
246         % git commit -a --amend
247
248       Now, create a fork on GitHub to push your branch to, and add it as a
249       remote if you haven't already, as described in the GitHub documentation
250       at <https://help.github.com/en/articles/working-with-forks>:
251
252         % git remote add fork git@github.com:MyUser/perl5.git
253
254       And push the branch to your fork:
255
256         % git push -u fork orange
257
258       You should now submit a Pull Request (PR) on GitHub from the new branch
259       to blead. For more information, see the GitHub documentation at
260       <https://help.github.com/en/articles/creating-a-pull-request-from-a-fork>.
261
262       You can also send patch files to perl5-porters@perl.org
263       <mailto:perl5-porters@perl.org> directly if the patch is not ready to
264       be applied, but intended for discussion.
265
266       To create a patch file for all your local changes:
267
268         % git format-patch -M blead..
269         0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
270
271       Or for a lot of changes, e.g. from a topic branch:
272
273         % git format-patch --stdout -M blead.. > topic-branch-changes.patch
274
275       If you want to delete your temporary branch, you may do so with:
276
277        % git checkout blead
278        % git branch -d orange
279        error: The branch 'orange' is not an ancestor of your current HEAD.
280        If you are sure you want to delete it, run 'git branch -D orange'.
281        % git branch -D orange
282        Deleted branch orange.
283
284   A note on derived files
285       Be aware that many files in the distribution are derivative--avoid
286       patching them, because git won't see the changes to them, and the build
287       process will overwrite them. Patch the originals instead. Most
288       utilities (like perldoc) are in this category, i.e. patch
289       utils/perldoc.PL rather than utils/perldoc. Similarly, don't create
290       patches for files under $src_root/ext from their copies found in
291       $install_root/lib. If you are unsure about the proper location of a
292       file that may have gotten copied while building the source
293       distribution, consult the MANIFEST.
294
295   Cleaning a working directory
296       The command "git clean" can with varying arguments be used as a
297       replacement for "make clean".
298
299       To reset your working directory to a pristine condition you can do:
300
301         % git clean -dxf
302
303       However, be aware this will delete ALL untracked content. You can use
304
305         % git clean -Xf
306
307       to remove all ignored untracked files, such as build and test
308       byproduct, but leave any manually created files alone.
309
310       If you only want to cancel some uncommitted edits, you can use "git
311       checkout" and give it a list of files to be reverted, or "git checkout
312       -f" to revert them all.
313
314       If you want to cancel one or several commits, you can use "git reset".
315
316   Bisecting
317       "git" provides a built-in way to determine which commit should be
318       blamed for introducing a given bug. "git bisect" performs a binary
319       search of history to locate the first failing commit. It is fast,
320       powerful and flexible, but requires some setup and to automate the
321       process an auxiliary shell script is needed.
322
323       The core provides a wrapper program, Porting/bisect.pl, which attempts
324       to simplify as much as possible, making bisecting as simple as running
325       a Perl one-liner. For example, if you want to know when this became an
326       error:
327
328           perl -e 'my $a := 2'
329
330       you simply run this:
331
332           .../Porting/bisect.pl -e 'my $a := 2;'
333
334       Using Porting/bisect.pl, with one command (and no other files) it's
335       easy to find out
336
337       •   Which commit caused this example code to break?
338
339       •   Which commit caused this example code to start working?
340
341       •   Which commit added the first file to match this regex?
342
343       •   Which commit removed the last file to match this regex?
344
345       usually without needing to know which versions of perl to use as start
346       and end revisions, as Porting/bisect.pl automatically searches to find
347       the earliest stable version for which the test case passes. Run
348       "Porting/bisect.pl --help" for the full documentation, including how to
349       set the "Configure" and build time options.
350
351       If you require more flexibility than Porting/bisect.pl has to offer,
352       you'll need to run "git bisect" yourself. It's most useful to use "git
353       bisect run" to automate the building and testing of perl revisions. For
354       this you'll need a shell script for "git" to call to test a particular
355       revision. An example script is Porting/bisect-example.sh, which you
356       should copy outside of the repository, as the bisect process will reset
357       the state to a clean checkout as it runs. The instructions below assume
358       that you copied it as ~/run and then edited it as appropriate.
359
360       You first enter in bisect mode with:
361
362         % git bisect start
363
364       For example, if the bug is present on "HEAD" but wasn't in 5.10.0,
365       "git" will learn about this when you enter:
366
367         % git bisect bad
368         % git bisect good perl-5.10.0
369         Bisecting: 853 revisions left to test after this
370
371       This results in checking out the median commit between "HEAD" and
372       "perl-5.10.0". You can then run the bisecting process with:
373
374         % git bisect run ~/run
375
376       When the first bad commit is isolated, "git bisect" will tell you so:
377
378         ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5 is first bad commit
379         commit ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5
380         Author: Dave Mitchell <davem@fdisolutions.com>
381         Date:   Sat Feb 9 14:56:23 2008 +0000
382
383             [perl #49472] Attributes + Unknown Error
384             ...
385
386         bisect run success
387
388       You can peek into the bisecting process with "git bisect log" and "git
389       bisect visualize". "git bisect reset" will get you out of bisect mode.
390
391       Please note that the first "good" state must be an ancestor of the
392       first "bad" state. If you want to search for the commit that solved
393       some bug, you have to negate your test case (i.e. exit with 1 if OK and
394       0 if not) and still mark the lower bound as "good" and the upper as
395       "bad". The "first bad commit" has then to be understood as the "first
396       commit where the bug is solved".
397
398       "git help bisect" has much more information on how you can tweak your
399       binary searches.
400
401       Following bisection you may wish to configure, build and test perl at
402       commits identified by the bisection process.  Sometimes, particularly
403       with older perls, "make" may fail during this process.  In this case
404       you may be able to patch the source code at the older commit point.  To
405       do so, please follow the suggestions provided in "Building perl at
406       older commits" in perlhack.
407
408   Topic branches and rewriting history
409       Individual committers should create topic branches under
410       yourname/some_descriptive_name:
411
412         % branch="$yourname/$some_descriptive_name"
413         % git checkout -b $branch
414         ... do local edits, commits etc ...
415         % git push origin -u $branch
416
417       Should you be stuck with an ancient version of git (prior to 1.7), then
418       "git push" will not have the "-u" switch, and you have to replace the
419       last step with the following sequence:
420
421         % git push origin $branch:refs/heads/$branch
422         % git config branch.$branch.remote origin
423         % git config branch.$branch.merge refs/heads/$branch
424
425       If you want to make changes to someone else's topic branch, you should
426       check with its creator before making any change to it.
427
428       You might sometimes find that the original author has edited the
429       branch's history. There are lots of good reasons for this. Sometimes,
430       an author might simply be rebasing the branch onto a newer source
431       point.  Sometimes, an author might have found an error in an early
432       commit which they wanted to fix before merging the branch to blead.
433
434       Currently the master repository is configured to forbid non-fast-
435       forward merges. This means that the branches within can not be rebased
436       and pushed as a single step.
437
438       The only way you will ever be allowed to rebase or modify the history
439       of a pushed branch is to delete it and push it as a new branch under
440       the same name. Please think carefully about doing this. It may be
441       better to sequentially rename your branches so that it is easier for
442       others working with you to cherry-pick their local changes onto the new
443       version. (XXX: needs explanation).
444
445       If you want to rebase a personal topic branch, you will have to delete
446       your existing topic branch and push as a new version of it. You can do
447       this via the following formula (see the explanation about "refspec"'s
448       in the git push documentation for details) after you have rebased your
449       branch:
450
451         # first rebase
452         % git checkout $user/$topic
453         % git fetch
454         % git rebase origin/blead
455
456         # then "delete-and-push"
457         % git push origin :$user/$topic
458         % git push origin $user/$topic
459
460       NOTE: it is forbidden at the repository level to delete any of the
461       "primary" branches. That is any branch matching
462       "m!^(blead|maint|perl)!". Any attempt to do so will result in git
463       producing an error like this:
464
465         % git push origin :blead
466         *** It is forbidden to delete blead/maint branches in this repository
467         error: hooks/update exited with error code 1
468         error: hook declined to update refs/heads/blead
469         To ssh://perl5.git.perl.org/perl
470          ! [remote rejected] blead (hook declined)
471          error: failed to push some refs to 'ssh://perl5.git.perl.org/perl'
472
473       As a matter of policy we do not edit the history of the blead and
474       maint-* branches. If a typo (or worse) sneaks into a commit to blead or
475       maint-*, we'll fix it in another commit. The only types of updates
476       allowed on these branches are "fast-forwards", where all history is
477       preserved.
478
479       Annotated tags in the canonical perl.git repository will never be
480       deleted or modified. Think long and hard about whether you want to push
481       a local tag to perl.git before doing so. (Pushing simple tags is not
482       allowed.)
483
484   Grafts
485       The perl history contains one mistake which was not caught in the
486       conversion: a merge was recorded in the history between blead and
487       maint-5.10 where no merge actually occurred. Due to the nature of git,
488       this is now impossible to fix in the public repository. You can remove
489       this mis-merge locally by adding the following line to your
490       ".git/info/grafts" file:
491
492        296f12bbbbaa06de9be9d09d3dcf8f4528898a49 434946e0cb7a32589ed92d18008aaa1d88515930
493
494       It is particularly important to have this graft line if any bisecting
495       is done in the area of the "merge" in question.
496

WRITE ACCESS TO THE GIT REPOSITORY

498       Once you have write access, you will need to modify the URL for the
499       origin remote to enable pushing. Edit .git/config with the
500       git-config(1) command:
501
502         % git config remote.origin.url git@github.com:Perl/perl5.git
503
504       You can also set up your user name and e-mail address. Most people do
505       this once globally in their ~/.gitconfig by doing something like:
506
507         % git config --global user.name "AEvar Arnfjoerd` Bjarmason"
508         % git config --global user.email avarab@gmail.com
509
510       However, if you'd like to override that just for perl, execute
511       something like the following in perl:
512
513         % git config user.email avar@cpan.org
514
515       It is also possible to keep "origin" as a git remote, and add a new
516       remote for ssh access:
517
518         % git remote add camel git@github.com:Perl/perl5.git
519
520       This allows you to update your local repository by pulling from
521       "origin", which is faster and doesn't require you to authenticate, and
522       to push your changes back with the "camel" remote:
523
524         % git fetch camel
525         % git push camel
526
527       The "fetch" command just updates the "camel" refs, as the objects
528       themselves should have been fetched when pulling from "origin".
529
530   Working with Github pull requests
531       Pull requests typically originate from outside of the "Perl/perl.git"
532       repository, so if you want to test or work with it locally a vanilla
533       "git fetch" from the "Perl/perl5.git" repository won't fetch it.
534
535       However Github does provide a mechanism to fetch a pull request to a
536       local branch.  They are available on Github remotes under "pull/", so
537       you can use "git fetch pull/PRID/head:localname" to make a local copy.
538       eg.  to fetch pull request 9999 to the local branch "local-branch-name"
539       run:
540
541         git fetch origin pull/9999/head:local-branch-name
542
543       and then:
544
545         git checkout local-branch-name
546
547       Note: this branch is not rebased on "blead", so instead of the checkout
548       above, you might want:
549
550         git rebase origin/blead local-branch-name
551
552       which rebases "local-branch-name" on "blead", and checks it out.
553
554       Alternatively you can configure the remote to fetch all pull requests
555       as remote-tracking branches.  To do this edit the remote in
556       .git/config, for example if your github remote is "origin" you'd have:
557
558         [remote "origin"]
559                 url = git@github.com:/Perl/perl5.git
560                 fetch = +refs/heads/*:refs/remotes/origin/*
561
562       Add a line to map the remote pull request branches to remote-tracking
563       branches:
564
565         [remote "origin"]
566                 url = git@github.com:/Perl/perl5.git
567                 fetch = +refs/heads/*:refs/remotes/origin/*
568                 fetch = +refs/pull/*/head:refs/remotes/origin/pull/*
569
570       and then do a fetch as normal:
571
572         git fetch origin
573
574       This will create a remote-tracking branch for every pull request,
575       including closed requests.
576
577       To remove those remote-tracking branches, remove the line added above
578       and prune:
579
580         git fetch -p origin # or git remote prune origin
581
582   Accepting a patch
583       If you have received a patch file generated using the above section,
584       you should try out the patch.
585
586       First we need to create a temporary new branch for these changes and
587       switch into it:
588
589        % git checkout -b experimental
590
591       Patches that were formatted by "git format-patch" are applied with "git
592       am":
593
594        % git am 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
595        Applying Rename Leon Brocard to Orange Brocard
596
597       Note that some UNIX mail systems can mess with text attachments
598       containing 'From '. This will fix them up:
599
600        % perl -pi -e's/^>From /From /' \
601                               0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
602
603       If just a raw diff is provided, it is also possible use this two-step
604       process:
605
606        % git apply bugfix.diff
607        % git commit -a -m "Some fixing" \
608                                   --author="That Guy <that.guy@internets.com>"
609
610       Now we can inspect the change:
611
612        % git show HEAD
613        commit b1b3dab48344cff6de4087efca3dbd63548ab5e2
614        Author: Leon Brocard <acme@astray.com>
615        Date:   Fri Dec 19 17:02:59 2008 +0000
616
617          Rename Leon Brocard to Orange Brocard
618
619        diff --git a/AUTHORS b/AUTHORS
620        index 293dd70..722c93e 100644
621        --- a/AUTHORS
622        +++ b/AUTHORS
623        @@ -541,7 +541,7 @@ Lars Hecking                 <lhecking@nmrc.ucc.ie>
624         Laszlo Molnar                  <laszlo.molnar@eth.ericsson.se>
625         Leif Huhn                      <leif@hale.dkstat.com>
626         Len Johnson                    <lenjay@ibm.net>
627        -Leon Brocard                   <acme@astray.com>
628        +Orange Brocard                 <acme@astray.com>
629         Les Peters                     <lpeters@aol.net>
630         Lesley Binks                   <lesley.binks@gmail.com>
631         Lincoln D. Stein               <lstein@cshl.org>
632
633       If you are a committer to Perl and you think the patch is good, you can
634       then merge it into blead then push it out to the main repository:
635
636         % git checkout blead
637         % git merge experimental
638         % git push origin blead
639
640       If you want to delete your temporary branch, you may do so with:
641
642        % git checkout blead
643        % git branch -d experimental
644        error: The branch 'experimental' is not an ancestor of your current
645        HEAD.  If you are sure you want to delete it, run 'git branch -D
646        experimental'.
647        % git branch -D experimental
648        Deleted branch experimental.
649
650   Committing to blead
651       The 'blead' branch will become the next production release of Perl.
652
653       Before pushing any local change to blead, it's incredibly important
654       that you do a few things, lest other committers come after you with
655       pitchforks and torches:
656
657       •   Make sure you have a good commit message. See "Commit message" in
658           perlhack for details.
659
660       •   Run the test suite. You might not think that one typo fix would
661           break a test file. You'd be wrong. Here's an example of where not
662           running the suite caused problems. A patch was submitted that added
663           a couple of tests to an existing .t. It couldn't possibly affect
664           anything else, so no need to test beyond the single affected .t,
665           right?  But, the submitter's email address had changed since the
666           last of their submissions, and this caused other tests to fail.
667           Running the test target given in the next item would have caught
668           this problem.
669
670       •   If you don't run the full test suite, at least "make test_porting".
671           This will run basic sanity checks. To see which sanity checks, have
672           a look in t/porting.
673
674       •   If you make any changes that affect miniperl or core routines that
675           have different code paths for miniperl, be sure to run "make
676           minitest".  This will catch problems that even the full test suite
677           will not catch because it runs a subset of tests under miniperl
678           rather than perl.
679
680   On merging and rebasing
681       Simple, one-off commits pushed to the 'blead' branch should be simple
682       commits that apply cleanly.  In other words, you should make sure your
683       work is committed against the current position of blead, so that you
684       can push back to the master repository without merging.
685
686       Sometimes, blead will move while you're building or testing your
687       changes.  When this happens, your push will be rejected with a message
688       like this:
689
690        To ssh://perl5.git.perl.org/perl.git
691         ! [rejected]        blead -> blead (non-fast-forward)
692        error: failed to push some refs to 'ssh://perl5.git.perl.org/perl.git'
693        To prevent you from losing history, non-fast-forward updates were
694        rejected Merge the remote changes (e.g. 'git pull') before pushing
695        again.  See the 'Note about fast-forwards' section of 'git push --help'
696        for details.
697
698       When this happens, you can just rebase your work against the new
699       position of blead, like this (assuming your remote for the master
700       repository is "p5p"):
701
702         % git fetch p5p
703         % git rebase p5p/blead
704
705       You will see your commits being re-applied, and you will then be able
706       to push safely.  More information about rebasing can be found in the
707       documentation for the git-rebase(1) command.
708
709       For larger sets of commits that only make sense together, or that would
710       benefit from a summary of the set's purpose, you should use a merge
711       commit.  You should perform your work on a topic branch, which you
712       should regularly rebase against blead to ensure that your code is not
713       broken by blead moving.  When you have finished your work, please
714       perform a final rebase and test.  Linear history is something that gets
715       lost with every commit on blead, but a final rebase makes the history
716       linear again, making it easier for future maintainers to see what has
717       happened.  Rebase as follows (assuming your work was on the branch
718       "committer/somework"):
719
720         % git checkout committer/somework
721         % git rebase blead
722
723       Then you can merge it into master like this:
724
725         % git checkout blead
726         % git merge --no-ff --no-commit committer/somework
727         % git commit -a
728
729       The switches above deserve explanation.  "--no-ff" indicates that even
730       if all your work can be applied linearly against blead, a merge commit
731       should still be prepared.  This ensures that all your work will be
732       shown as a side branch, with all its commits merged into the mainstream
733       blead by the merge commit.
734
735       "--no-commit" means that the merge commit will be prepared but not
736       committed.  The commit is then actually performed when you run the next
737       command, which will bring up your editor to describe the commit.
738       Without "--no-commit", the commit would be made with nearly no useful
739       message, which would greatly diminish the value of the merge commit as
740       a placeholder for the work's description.
741
742       When describing the merge commit, explain the purpose of the branch,
743       and keep in mind that this description will probably be used by the
744       eventual release engineer when reviewing the next perldelta document.
745
746   Committing to maintenance versions
747       Maintenance versions should only be altered to add critical bug fixes,
748       see perlpolicy.
749
750       To commit to a maintenance version of perl, you need to create a local
751       tracking branch:
752
753         % git checkout --track -b maint-5.005 origin/maint-5.005
754
755       This creates a local branch named "maint-5.005", which tracks the
756       remote branch "origin/maint-5.005". Then you can pull, commit, merge
757       and push as before.
758
759       You can also cherry-pick commits from blead and another branch, by
760       using the "git cherry-pick" command. It is recommended to use the -x
761       option to "git cherry-pick" in order to record the SHA1 of the original
762       commit in the new commit message.
763
764       Before pushing any change to a maint version, make sure you've
765       satisfied the steps in "Committing to blead" above.
766
767   Using a smoke-me branch to test changes
768       Sometimes a change affects code paths which you cannot test on the OSes
769       which are directly available to you and it would be wise to have users
770       on other OSes test the change before you commit it to blead.
771
772       Fortunately, there is a way to get your change smoke-tested on various
773       OSes: push it to a "smoke-me" branch and wait for certain automated
774       smoke-testers to report the results from their OSes.  A "smoke-me"
775       branch is identified by the branch name: specifically, as seen on
776       github.com it must be a local branch whose first name component is
777       precisely "smoke-me".
778
779       The procedure for doing this is roughly as follows (using the example
780       of tonyc's smoke-me branch called win32stat):
781
782       First, make a local branch and switch to it:
783
784         % git checkout -b win32stat
785
786       Make some changes, build perl and test your changes, then commit them
787       to your local branch. Then push your local branch to a remote smoke-me
788       branch:
789
790         % git push origin win32stat:smoke-me/tonyc/win32stat
791
792       Now you can switch back to blead locally:
793
794         % git checkout blead
795
796       and continue working on other things while you wait a day or two,
797       keeping an eye on the results reported for your smoke-me branch at
798       <http://perl.develop-help.com/?b=smoke-me/tonyc/win32state>.
799
800       If all is well then update your blead branch:
801
802         % git pull
803
804       then checkout your smoke-me branch once more and rebase it on blead:
805
806         % git rebase blead win32stat
807
808       Now switch back to blead and merge your smoke-me branch into it:
809
810         % git checkout blead
811         % git merge win32stat
812
813       As described earlier, if there are many changes on your smoke-me branch
814       then you should prepare a merge commit in which to give an overview of
815       those changes by using the following command instead of the last
816       command above:
817
818         % git merge win32stat --no-ff --no-commit
819
820       You should now build perl and test your (merged) changes one last time
821       (ideally run the whole test suite, but failing that at least run the
822       t/porting/*.t tests) before pushing your changes as usual:
823
824         % git push origin blead
825
826       Finally, you should then delete the remote smoke-me branch:
827
828         % git push origin :smoke-me/tonyc/win32stat
829
830       (which is likely to produce a warning like this, which can be ignored:
831
832        remote: fatal: ambiguous argument
833                                         'refs/heads/smoke-me/tonyc/win32stat':
834        unknown revision or path not in the working tree.
835        remote: Use '--' to separate paths from revisions
836
837       ) and then delete your local branch:
838
839         % git branch -d win32stat
840
841
842
843perl v5.36.3                      2023-11-30                        PERLGIT(1)
Impressum