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       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:
26
27         % git clone https://github.com/Perl/perl5.git perl
28

WORKING WITH THE REPOSITORY

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. See "Commit message" in perlhack for more information about
216       what makes a good commit message.
217
218       Once you've finished writing your commit message and exited your
219       editor, git will write your change to disk and tell you something like
220       this:
221
222        Created commit daf8e63: explain git status and stuff about remotes
223         1 files changed, 83 insertions(+), 3 deletions(-)
224
225       If you re-run "git status", you should see something like this:
226
227        % git status
228        On branch orange
229        Untracked files:
230          (use "git add <file>..." to include in what will be committed)
231
232              deliberate.untracked
233
234        nothing added to commit but untracked files present (use "git add" to
235                                                                         track)
236
237       When in doubt, before you do anything else, check your status and read
238       it carefully, many questions are answered directly by the git status
239       output.
240
241       You can examine your last commit with:
242
243         % git show HEAD
244
245       and if you are not happy with either the description or the patch
246       itself you can fix it up by editing the files once more and then issue:
247
248         % git commit -a --amend
249
250       Now, create a fork on GitHub to push your branch to, and add it as a
251       remote if you haven't already, as described in the GitHub documentation
252       at <https://help.github.com/en/articles/working-with-forks>:
253
254         % git remote add fork git@github.com:MyUser/perl5.git
255
256       And push the branch to your fork:
257
258         % git push -u fork orange
259
260       You should now submit a Pull Request (PR) on GitHub from the new branch
261       to blead. For more information, see the GitHub documentation at
262       <https://help.github.com/en/articles/creating-a-pull-request-from-a-fork>.
263
264       You can also send patch files to perl5-porters@perl.org
265       <mailto:perl5-porters@perl.org> directly if the patch is not ready to
266       be applied, but intended for discussion.
267
268       To create a patch file for all your local changes:
269
270         % git format-patch -M blead..
271         0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
272
273       Or for a lot of changes, e.g. from a topic branch:
274
275         % git format-patch --stdout -M blead.. > topic-branch-changes.patch
276
277       If you want to delete your temporary branch, you may do so with:
278
279        % git checkout blead
280        % git branch -d orange
281        error: The branch 'orange' is not an ancestor of your current HEAD.
282        If you are sure you want to delete it, run 'git branch -D orange'.
283        % git branch -D orange
284        Deleted branch orange.
285
286   A note on derived files
287       Be aware that many files in the distribution are derivative--avoid
288       patching them, because git won't see the changes to them, and the build
289       process will overwrite them. Patch the originals instead. Most
290       utilities (like perldoc) are in this category, i.e. patch
291       utils/perldoc.PL rather than utils/perldoc. Similarly, don't create
292       patches for files under $src_root/ext from their copies found in
293       $install_root/lib. If you are unsure about the proper location of a
294       file that may have gotten copied while building the source
295       distribution, consult the MANIFEST.
296
297   Cleaning a working directory
298       The command "git clean" can with varying arguments be used as a
299       replacement for "make clean".
300
301       To reset your working directory to a pristine condition you can do:
302
303         % git clean -dxf
304
305       However, be aware this will delete ALL untracked content. You can use
306
307         % git clean -Xf
308
309       to remove all ignored untracked files, such as build and test
310       byproduct, but leave any manually created files alone.
311
312       If you only want to cancel some uncommitted edits, you can use "git
313       checkout" and give it a list of files to be reverted, or "git checkout
314       -f" to revert them all.
315
316       If you want to cancel one or several commits, you can use "git reset".
317
318   Bisecting
319       "git" provides a built-in way to determine which commit should be
320       blamed for introducing a given bug. "git bisect" performs a binary
321       search of history to locate the first failing commit. It is fast,
322       powerful and flexible, but requires some setup and to automate the
323       process an auxiliary shell script is needed.
324
325       The core provides a wrapper program, Porting/bisect.pl, which attempts
326       to simplify as much as possible, making bisecting as simple as running
327       a Perl one-liner. For example, if you want to know when this became an
328       error:
329
330           perl -e 'my $a := 2'
331
332       you simply run this:
333
334           .../Porting/bisect.pl -e 'my $a := 2;'
335
336       Using Porting/bisect.pl, with one command (and no other files) it's
337       easy to find out
338
339       •   Which commit caused this example code to break?
340
341       •   Which commit caused this example code to start working?
342
343       •   Which commit added the first file to match this regex?
344
345       •   Which commit removed the last file to match this regex?
346
347       usually without needing to know which versions of perl to use as start
348       and end revisions, as Porting/bisect.pl automatically searches to find
349       the earliest stable version for which the test case passes. Run
350       "Porting/bisect.pl --help" for the full documentation, including how to
351       set the "Configure" and build time options.
352
353       If you require more flexibility than Porting/bisect.pl has to offer,
354       you'll need to run "git bisect" yourself. It's most useful to use "git
355       bisect run" to automate the building and testing of perl revisions. For
356       this you'll need a shell script for "git" to call to test a particular
357       revision. An example script is Porting/bisect-example.sh, which you
358       should copy outside of the repository, as the bisect process will reset
359       the state to a clean checkout as it runs. The instructions below assume
360       that you copied it as ~/run and then edited it as appropriate.
361
362       You first enter in bisect mode with:
363
364         % git bisect start
365
366       For example, if the bug is present on "HEAD" but wasn't in 5.10.0,
367       "git" will learn about this when you enter:
368
369         % git bisect bad
370         % git bisect good perl-5.10.0
371         Bisecting: 853 revisions left to test after this
372
373       This results in checking out the median commit between "HEAD" and
374       "perl-5.10.0". You can then run the bisecting process with:
375
376         % git bisect run ~/run
377
378       When the first bad commit is isolated, "git bisect" will tell you so:
379
380         ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5 is first bad commit
381         commit ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5
382         Author: Dave Mitchell <davem@fdisolutions.com>
383         Date:   Sat Feb 9 14:56:23 2008 +0000
384
385             [perl #49472] Attributes + Unknown Error
386             ...
387
388         bisect run success
389
390       You can peek into the bisecting process with "git bisect log" and "git
391       bisect visualize". "git bisect reset" will get you out of bisect mode.
392
393       Please note that the first "good" state must be an ancestor of the
394       first "bad" state. If you want to search for the commit that solved
395       some bug, you have to negate your test case (i.e. exit with 1 if OK and
396       0 if not) and still mark the lower bound as "good" and the upper as
397       "bad". The "first bad commit" has then to be understood as the "first
398       commit where the bug is solved".
399
400       "git help bisect" has much more information on how you can tweak your
401       binary searches.
402
403       Following bisection you may wish to configure, build and test perl at
404       commits identified by the bisection process.  Sometimes, particularly
405       with older perls, "make" may fail during this process.  In this case
406       you may be able to patch the source code at the older commit point.  To
407       do so, please follow the suggestions provided in "Building perl at
408       older commits" in perlhack.
409
410   Topic branches and rewriting history
411       Individual committers should create topic branches under
412       yourname/some_descriptive_name:
413
414         % branch="$yourname/$some_descriptive_name"
415         % git checkout -b $branch
416         ... do local edits, commits etc ...
417         % git push origin -u $branch
418
419       Should you be stuck with an ancient version of git (prior to 1.7), then
420       "git push" will not have the "-u" switch, and you have to replace the
421       last step with the following sequence:
422
423         % git push origin $branch:refs/heads/$branch
424         % git config branch.$branch.remote origin
425         % git config branch.$branch.merge refs/heads/$branch
426
427       If you want to make changes to someone else's topic branch, you should
428       check with its creator before making any change to it.
429
430       You might sometimes find that the original author has edited the
431       branch's history. There are lots of good reasons for this. Sometimes,
432       an author might simply be rebasing the branch onto a newer source
433       point.  Sometimes, an author might have found an error in an early
434       commit which they wanted to fix before merging the branch to blead.
435
436       Currently the master repository is configured to forbid non-fast-
437       forward merges. This means that the branches within can not be rebased
438       and pushed as a single step.
439
440       The only way you will ever be allowed to rebase or modify the history
441       of a pushed branch is to delete it and push it as a new branch under
442       the same name. Please think carefully about doing this. It may be
443       better to sequentially rename your branches so that it is easier for
444       others working with you to cherry-pick their local changes onto the new
445       version. (XXX: needs explanation).
446
447       If you want to rebase a personal topic branch, you will have to delete
448       your existing topic branch and push as a new version of it. You can do
449       this via the following formula (see the explanation about "refspec"'s
450       in the git push documentation for details) after you have rebased your
451       branch:
452
453         # first rebase
454         % git checkout $user/$topic
455         % git fetch
456         % git rebase origin/blead
457
458         # then "delete-and-push"
459         % git push origin :$user/$topic
460         % git push origin $user/$topic
461
462       NOTE: it is forbidden at the repository level to delete any of the
463       "primary" branches. That is any branch matching
464       "m!^(blead|maint|perl)!". Any attempt to do so will result in git
465       producing an error like this:
466
467         % git push origin :blead
468         *** It is forbidden to delete blead/maint branches in this repository
469         error: hooks/update exited with error code 1
470         error: hook declined to update refs/heads/blead
471         To ssh://perl5.git.perl.org/perl
472          ! [remote rejected] blead (hook declined)
473          error: failed to push some refs to 'ssh://perl5.git.perl.org/perl'
474
475       As a matter of policy we do not edit the history of the blead and
476       maint-* branches. If a typo (or worse) sneaks into a commit to blead or
477       maint-*, we'll fix it in another commit. The only types of updates
478       allowed on these branches are "fast-forwards", where all history is
479       preserved.
480
481       Annotated tags in the canonical perl.git repository will never be
482       deleted or modified. Think long and hard about whether you want to push
483       a local tag to perl.git before doing so. (Pushing simple tags is not
484       allowed.)
485
486   Grafts
487       The perl history contains one mistake which was not caught in the
488       conversion: a merge was recorded in the history between blead and
489       maint-5.10 where no merge actually occurred. Due to the nature of git,
490       this is now impossible to fix in the public repository. You can remove
491       this mis-merge locally by adding the following line to your
492       ".git/info/grafts" file:
493
494        296f12bbbbaa06de9be9d09d3dcf8f4528898a49 434946e0cb7a32589ed92d18008aaa1d88515930
495
496       It is particularly important to have this graft line if any bisecting
497       is done in the area of the "merge" in question.
498

WRITE ACCESS TO THE GIT REPOSITORY

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