2 Consistent formatting of this file is achieved with:
3 perl ./Porting/podtidy pod/perlrepository.pod
7 perlrepository - Using the Perl source repository
11 All of Perl's source code is kept centrally in a Git repository at
12 I<perl5.git.perl.org>. The repository contains many Perl revisions from
13 Perl 1 onwards and all the revisions from Perforce, the version control
14 system we were using previously. This repository is accessible in
17 The full repository takes up about 80MB of disk space. A check out of
18 the blead branch (that is, the main development branch, which contains
19 bleadperl, the development version of perl 5) takes up about 160MB of
20 disk space (including the repository). A build of bleadperl takes up
21 about 200MB (including the repository and the check out).
23 =head1 Getting access to the repository
25 =head2 Read access via the web
27 You may access the repository over the web. This allows you to browse
28 the tree, see recent commits, subscribe to RSS feeds for the changes,
29 search for particular commits and more. You may access it at:
31 http://perl5.git.perl.org/perl.git
33 A mirror of the repository is found at:
35 http://github.com/mirrors/perl
37 =head2 Read access via Git
39 You will need a copy of Git for your computer. You can fetch a copy of
40 the repository using the Git protocol (which uses port 9418):
42 % git clone git://perl5.git.perl.org/perl.git perl-git
44 This clones the repository and makes a local copy in the F<perl-git>
47 If your local network does not allow you to use port 9418, then you can
48 fetch a copy of the repository over HTTP (this is at least 4x slower):
50 % git clone http://perl5.git.perl.org/perl.git perl-http
52 This clones the repository and makes a local copy in the F<perl-http>
55 =head2 Write access to the repository
57 If you are a committer, then you can fetch a copy of the repository
58 that you can push back on with:
60 % git clone ssh://perl5.git.perl.org/perl.git perl-ssh
62 This clones the repository and makes a local copy in the F<perl-ssh>
65 If you cloned using the git protocol, which is faster than ssh, then
66 you will need to modify the URL for the origin remote to enable
67 pushing. To do that edit F<.git/config> with git-config(1) like
70 % git config remote.origin.url ssh://perl5.git.perl.org/perl.git
72 You can also set up your user name and e-mail address. Most people do
73 this once globally in their F<~/.gitconfig> by doing something like:
75 % git config --global user.name "Ævar Arnfjörð Bjarmason"
76 % git config --global user.email avarab@gmail.com
78 However if you'd like to override that just for perl then execute then
79 execute something like the following in F<perl-git>:
81 % git config user.email avar@cpan.org
83 It is also possible to keep C<origin> as a git remote, and add a new
84 remote for ssh access:
86 % git remote add camel perl5.git.perl.org:/perl.git
88 This allows you to update your local repository by pulling from
89 C<origin>, which is faster and doesn't require you to authenticate, and
90 to push your changes back with the C<camel> remote:
95 The C<fetch> command just updates the C<camel> refs, as the objects
96 themselves should have been fetched when pulling from C<origin>.
98 =head2 A note on camel and dromedary
100 The committers have SSH access to the two servers that serve
101 C<perl5.git.perl.org>. One is C<perl5.git.perl.org> itself (I<camel>),
102 which is the 'master' repository. The second one is
103 C<users.perl5.git.perl.org> (I<dromedary>), which can be used for
104 general testing and development. Dromedary syncs the git tree from
105 camel every few minutes, you should not push there. Both machines also
106 have a full CPAN mirror in /srv/CPAN, please use this. To share files
107 with the general public, dromedary serves your ~/public_html/ as
108 C<http://users.perl5.git.perl.org/~yourlogin/>
110 These hosts have fairly strict firewalls to the outside. Outgoing, only
111 rsync, ssh and git are allowed. For http and ftp, you can use
112 http://webproxy:3128 as proxy. Incoming, the firewall tries to detect
113 attacks and blocks IP addresses with suspicious activity. This
114 sometimes (but very rarely) has false positives and you might get
115 blocked. The quickest way to get unblocked is to notify the admins.
117 These two boxes are owned, hosted, and operated by booking.com. You can
118 reach the sysadmins in #p5p on irc.perl.org or via mail to
119 C<perl5-porters@perl.org>
121 =head1 Overview of the repository
123 Once you have changed into the repository directory, you can inspect
126 After a clone the repository will contain a single local branch, which
127 will be the current branch as well, as indicated by the asterisk.
132 Using the -a switch to C<branch> will also show the remote tracking
133 branches in the repository:
141 The branches that begin with "origin" correspond to the "git remote"
142 that you cloned from (which is named "origin"). Each branch on the
143 remote will be exactly tracked by theses branches. You should NEVER do
144 work on these remote tracking branches. You only ever do work in a
145 local branch. Local branches can be configured to automerge (on pull)
146 from a designated remote tracking branch. This is the case with the
147 default branch C<blead> which will be configured to merge from the
148 remote tracking branch C<origin/blead>.
150 You can see recent commits:
154 And pull new changes from the repository, and update your local
155 repository (must be clean first)
159 Assuming we are on the branch C<blead> immediately after a pull, this
160 command would be more or less equivalent to:
163 % git merge origin/blead
165 In fact if you want to update your local repository without touching
166 your working directory you do:
170 And if you want to update your remote-tracking branches for all defined
171 remotes simultaneously you can do
175 Neither of these last two commands will update your working directory,
176 however both will update the remote-tracking branches in your
179 To make a local branch of a remote branch:
181 % git checkout -b maint-5.10 origin/maint-5.10
183 To switch back to blead:
187 =head2 Finding out your status
189 The most common git command you will use will probably be
193 This command will produce as output a description of the current state
194 of the repository, including modified files and unignored untracked
195 files, and in addition it will show things like what files have been
196 staged for the next commit, and usually some useful information about
197 how to change things. For instance the following:
201 # Your branch is ahead of 'origin/blead' by 1 commit.
203 # Changes to be committed:
204 # (use "git reset HEAD <file>..." to unstage)
206 # modified: pod/perlrepository.pod
208 # Changed but not updated:
209 # (use "git add <file>..." to update what will be committed)
211 # modified: pod/perlrepository.pod
214 # (use "git add <file>..." to include in what will be committed)
216 # deliberate.untracked
218 This shows that there were changes to this document staged for commit,
219 and that there were further changes in the working directory not yet
220 staged. It also shows that there was an untracked file in the working
221 directory, and as you can see shows how to change all of this. It also
222 shows that there is one commit on the working branch C<blead> which has
223 not been pushed to the C<origin> remote yet. B<NOTE>: that this output
224 is also what you see as a template if you do not provide a message to
227 Assuming that you'd like to commit all the changes you've just made as a
228 a single atomic unit, run this command:
232 (That C<-a> tells git to add every file you've changed to this commit.
233 New files aren't automatically added to your commit when you use C<commit
234 -a> If you want to add files or to commit some, but not all of your
235 changes, have a look at the documentation for C<git add>.)
237 Git will start up your favorite text editor, so that you can craft a
238 commit message for your change. See L</Commit message> below for more
239 information about what makes a good commit message.
241 Once you've finished writing your commit message and exited your editor,
242 git will write your change to disk and tell you something like this:
244 Created commit daf8e63: explain git status and stuff about remotes
245 1 files changed, 83 insertions(+), 3 deletions(-)
248 If you re-run C<git status>, you should see something like this:
252 # Your branch is ahead of 'origin/blead' by 2 commits.
255 # (use "git add <file>..." to include in what will be committed)
257 # deliberate.untracked
258 nothing added to commit but untracked files present (use "git add" to track)
261 When in doubt, before you do anything else, check your status and read
262 it carefully, many questions are answered directly by the git status
265 =head1 Submitting a patch
267 If you have a patch in mind for Perl, you should first get a copy of
270 % git clone git://perl5.git.perl.org/perl.git perl-git
272 Then change into the directory:
276 Alternatively, if you already have a Perl repository, you should ensure
277 that you're on the I<blead> branch, and your repository is up to date:
282 It's preferable to patch against the latest blead version, since this
283 is where new development occurs for all changes other than critical bug
284 fixes. Critical bug fix patches should be made against the relevant
285 maint branches, or should be submitted with a note indicating all the
286 branches where the fix should be applied.
288 Now that we have everything up to date, we need to create a temporary
289 new branch for these changes and switch into it:
291 % git checkout -b orange
293 which is the short form of
296 % git checkout orange
298 Creating a topic branch makes it easier for the maintainers to rebase
299 or merge back into the master blead for a more linear history. If you
300 don't work on a topic branch the maintainer has to manually cherry
301 pick your changes onto blead before they can be applied.
303 That'll get you scolded on perl5-porters, so don't do that. Be
306 Then make your changes. For example, if Leon Brocard changes his name
307 to Orange Brocard, we should change his name in the AUTHORS file:
309 % perl -pi -e 's{Leon Brocard}{Orange Brocard}' AUTHORS
311 You can see what files are changed:
315 # Changes to be committed:
316 # (use "git reset HEAD <file>..." to unstage)
321 And you can see the changes:
324 diff --git a/AUTHORS b/AUTHORS
325 index 293dd70..722c93e 100644
328 @@ -541,7 +541,7 @@ Lars Hecking <lhecking@nmrc.ucc.ie>
329 Laszlo Molnar <laszlo.molnar@eth.ericsson.se>
330 Leif Huhn <leif@hale.dkstat.com>
331 Len Johnson <lenjay@ibm.net>
332 -Leon Brocard <acme@astray.com>
333 +Orange Brocard <acme@astray.com>
334 Les Peters <lpeters@aol.net>
335 Lesley Binks <lesley.binks@gmail.com>
336 Lincoln D. Stein <lstein@cshl.org>
338 Now commit your change locally:
340 % git commit -a -m 'Rename Leon Brocard to Orange Brocard'
341 Created commit 6196c1d: Rename Leon Brocard to Orange Brocard
342 1 files changed, 1 insertions(+), 1 deletions(-)
344 You can examine your last commit with:
348 and if you are not happy with either the description or the patch
349 itself you can fix it up by editing the files once more and then issue:
351 % git commit -a --amend
353 Now you should create a patch file for all your local changes:
355 % git format-patch -M origin..
356 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
358 You should now send an email to either perlbug@perl.org or
359 perl5-porters@perl.org with a description of your changes, and include
360 this patch file as an attachment. The perlbug address is preferred,
361 but use perl5-porters for patches intended for discussion.
363 See the next section for how to configure and use git to send these
366 If you want to delete your temporary branch, you may do so with:
369 % git branch -d orange
370 error: The branch 'orange' is not an ancestor of your current HEAD.
371 If you are sure you want to delete it, run 'git branch -D orange'.
372 % git branch -D orange
373 Deleted branch orange.
375 =head2 Using git to send patch emails
377 In your ~/git/perl repository, set the destination email to perl's bug
380 $ git config sendemail.to perlbug@perl.org
382 Or maybe perl5-porters (discussed above):
384 $ git config sendemail.to perl5-porters@perl.org
386 Then you can use git directly to send your patch emails:
388 $ git send-email 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
390 You may need to set some configuration variables for your particular
391 email service provider. For example, to set your global git config to
392 send email via a gmail account:
394 $ git config --global sendemail.smtpserver smtp.gmail.com
395 $ git config --global sendemail.smtpssl 1
396 $ git config --global sendemail.smtpuser YOURUSERNAME@gmail.com
398 With this configuration, you will be prompted for your gmail password
399 when you run 'git send-email'. You can also configure
400 C<sendemail.smtppass> with your password if you don't care about having
401 your password in the .gitconfig file.
403 =head2 A note on derived files
405 Be aware that many files in the distribution are derivative--avoid
406 patching them, because git won't see the changes to them, and the build
407 process will overwrite them. Patch the originals instead. Most
408 utilities (like perldoc) are in this category, i.e. patch
409 F<utils/perldoc.PL> rather than F<utils/perldoc>. Similarly, don't create
410 patches for files under $src_root/ext from their copies found in
411 $install_root/lib. If you are unsure about the proper location of a
412 file that may have gotten copied while building the source
413 distribution, consult the C<MANIFEST>.
415 As a special case, several files are regenerated by 'make regen' if
416 your patch alters C<embed.fnc>. These are needed for compilation, but
417 are included in the distribution so that you can build perl without
418 needing another perl to generate the files. You must test with these
419 regenerated files, but it is preferred that you instead note that
420 'make regen is needed' in both the email and the commit message, and
421 submit your patch without them. If you're submitting a series of
422 patches, it might be best to submit the regenerated changes
423 immediately after the source-changes that caused them, so as to have
424 as little effect as possible on the bisectability of your patchset.
428 What should we recommend about binary files now? Do we need anything?
430 =head2 Getting your patch accepted
432 If you are submitting a code patch there are several things that
439 As you craft each patch you intend to submit to the Perl core, it's
440 important to write a good commit message.
442 The first line of the commit message should be a short description and
443 should skip the full stop. It should be no longer than the subject
444 line of an E-Mail, 50 characters being a good rule of thumb.
446 A lot of Git tools (Gitweb, GitHub, git log --pretty=oneline, ..) will
447 only display the first line (cut off at 50 characters) when presenting
450 The commit message should include description of the problem that the
451 patch corrects or new functionality that the patch adds.
453 As a general rule of thumb, your commit message should let a programmer
454 with a reasonable familiarity with the Perl core quickly understand what
455 you were trying to do, how you were trying to do it and why the change
462 Your commit message should describe what part of the Perl core you're
463 changing and what you expect your patch to do.
467 Perhaps most importantly, your commit message should describe why the
468 change you are making is important. When someone looks at your change
469 in six months or six years, your intent should be clear. If you're
470 deprecating a feature with the intent of later simplifying another bit
471 of code, say so. If you're fixing a performance problem or adding a new
472 feature to support some other bit of the core, mention that.
476 While it's not necessary for documentation changes, new tests or
477 trivial patches, it's often worth explaining how your change works.
478 Even if it's clear to you today, it may not be clear to a porter next
483 A commit message isn't intended to take the place of comments in your
484 code. Commit messages should describe the change you made, while code
485 comments should describe the current state of the code. If you've just
486 implemented a new feature, complete with doc, tests and well-commented
487 code, a brief commit message will often suffice. If, however, you've
488 just changed a single character deep in the parser or lexer, you might
489 need to write a small novel to ensure that future readers understand
490 what you did and why you did it.
492 =item Comments, Comments, Comments
494 Be sure to adequately comment your code. While commenting every line
495 is unnecessary, anything that takes advantage of side effects of
496 operators, that creates changes that will be felt outside of the
497 function being patched, or that others may find confusing should be
498 documented. If you are going to err, it is better to err on the side
499 of adding too many comments than too few.
503 In general, please follow the particular style of the code you are
506 In particular, follow these general guidelines for patching Perl
509 8-wide tabs (no exceptions!)
510 4-wide indents for code, 2-wide indents for nested CPP #defines
511 try hard not to exceed 79-columns
513 uncuddled elses and "K&R" style for indenting control constructs
514 no C++ style (//) comments
515 mark places that need to be revisited with XXX (and revisit often!)
516 opening brace lines up with "if" when conditional spans multiple
517 lines; should be at end-of-line otherwise
518 in function definitions, name starts in column 0 (return value is on
520 single space after keywords that are followed by parens, no space
521 between function name and following paren
522 avoid assignments in conditionals, but if they're unavoidable, use
523 extra paren, e.g. "if (a && (b = c)) ..."
524 "return foo;" rather than "return(foo);"
525 "if (!foo) ..." rather than "if (foo == FALSE) ..." etc.
529 If your patch changes code (rather than just changing documentation) you
530 should also include one or more test cases which illustrate the bug you're
531 fixing or validate the new functionality you're adding. In general,
532 you should update an existing test file rather than create a new one.
534 Your testsuite additions should generally follow these guidelines
535 (courtesy of Gurusamy Sarathy <gsar@activestate.com>):
537 Know what you're testing. Read the docs, and the source.
538 Tend to fail, not succeed.
539 Interpret results strictly.
540 Use unrelated features (this will flush out bizarre interactions).
541 Use non-standard idioms (otherwise you are not testing TIMTOWTDI).
542 Avoid using hardcoded test numbers whenever possible (the
543 EXPECTED/GOT found in t/op/tie.t is much more maintainable,
544 and gives better failure reports).
545 Give meaningful error messages when a test fails.
546 Avoid using qx// and system() unless you are testing for them. If you
547 do use them, make sure that you cover _all_ perl platforms.
548 Unlink any temporary files you create.
549 Promote unforeseen warnings to errors with $SIG{__WARN__}.
550 Be sure to use the libraries and modules shipped with the version
551 being tested, not those that were already installed.
552 Add comments to the code explaining what you are testing for.
553 Make updating the '1..42' string unnecessary. Or make sure that
555 Test _all_ behaviors of a given operator, library, or function:
556 - All optional arguments
557 - Return values in various contexts (boolean, scalar, list, lvalue)
558 - Use both global and lexical variables
559 - Don't forget the exceptional, pathological cases.
563 =head1 Accepting a patch
565 If you have received a patch file generated using the above section,
566 you should try out the patch.
568 First we need to create a temporary new branch for these changes and
571 % git checkout -b experimental
573 Patches that were formatted by C<git format-patch> are applied with
576 % git am 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
577 Applying Rename Leon Brocard to Orange Brocard
579 If just a raw diff is provided, it is also possible use this two-step
582 % git apply bugfix.diff
583 % git commit -a -m "Some fixing" --author="That Guy <that.guy@internets.com>"
585 Now we can inspect the change:
588 commit b1b3dab48344cff6de4087efca3dbd63548ab5e2
589 Author: Leon Brocard <acme@astray.com>
590 Date: Fri Dec 19 17:02:59 2008 +0000
592 Rename Leon Brocard to Orange Brocard
594 diff --git a/AUTHORS b/AUTHORS
595 index 293dd70..722c93e 100644
598 @@ -541,7 +541,7 @@ Lars Hecking <lhecking@nmrc.ucc.ie>
599 Laszlo Molnar <laszlo.molnar@eth.ericsson.se>
600 Leif Huhn <leif@hale.dkstat.com>
601 Len Johnson <lenjay@ibm.net>
602 -Leon Brocard <acme@astray.com>
603 +Orange Brocard <acme@astray.com>
604 Les Peters <lpeters@aol.net>
605 Lesley Binks <lesley.binks@gmail.com>
606 Lincoln D. Stein <lstein@cshl.org>
608 If you are a committer to Perl and you think the patch is good, you can
609 then merge it into blead then push it out to the main repository:
612 % git merge experimental
615 If you want to delete your temporary branch, you may do so with:
618 % git branch -d experimental
619 error: The branch 'experimental' is not an ancestor of your current HEAD.
620 If you are sure you want to delete it, run 'git branch -D experimental'.
621 % git branch -D experimental
622 Deleted branch experimental.
624 =head1 Cleaning a working directory
626 The command C<git clean> can with varying arguments be used as a
627 replacement for C<make clean>.
629 To reset your working directory to a pristine condition you can do:
633 However, be aware this will delete ALL untracked content. You can use
637 to remove all ignored untracked files, such as build and test
638 byproduct, but leave any manually created files alone.
640 If you only want to cancel some uncommitted edits, you can use C<git
641 checkout> and give it a list of files to be reverted, or C<git checkout
642 -f> to revert them all.
644 If you want to cancel one or several commits, you can use C<git reset>.
648 C<git> provides a built-in way to determine, with a binary search in
649 the history, which commit should be blamed for introducing a given bug.
651 Suppose that we have a script F<~/testcase.pl> that exits with C<0>
652 when some behaviour is correct, and with C<1> when it's faulty. You need
653 an helper script that automates building C<perl> and running the
660 # If you get './makedepend: 1: Syntax error: Unterminated quoted
661 # string' when bisecting versions of perl older than 5.9.5 this hack
662 # will work around the bug in makedepend.SH which was fixed in
663 # version 96a8704c. Make sure to comment out `git co makedepend.SH'
665 git show blead:makedepend.SH > makedepend.SH
667 # If you can use ccache, add -Dcc=ccache\ gcc -Dld=gcc to the Configure line
668 # if Encode is not needed for the test, you can speed up the bisect by
669 # excluding it from the runs with -Dnoextensions=Encode
670 sh Configure -des -Dusedevel -Doptimize="-g"
671 test -f config.sh || exit 125
672 # Correct makefile for newer GNU gcc
673 perl -ni -we 'print unless /<(?:built-in|command)/' makefile x2p/makefile
674 # if you just need miniperl, replace test_prep with miniperl
676 [ -x ./perl ] || exit 125
677 ./perl -Ilib ~/testcase.pl
679 [ $ret -gt 127 ] && ret=127
680 # git co makedepend.SH
684 This script may return C<125> to indicate that the corresponding commit
685 should be skipped. Otherwise, it returns the status of
688 You first enter in bisect mode with:
692 For example, if the bug is present on C<HEAD> but wasn't in 5.10.0,
693 C<git> will learn about this when you enter:
696 % git bisect good perl-5.10.0
697 Bisecting: 853 revisions left to test after this
699 This results in checking out the median commit between C<HEAD> and
700 C<perl-5.10.0>. You can then run the bisecting process with:
702 % git bisect run ~/run
704 When the first bad commit is isolated, C<git bisect> will tell you so:
706 ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5 is first bad commit
707 commit ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5
708 Author: Dave Mitchell <davem@fdisolutions.com>
709 Date: Sat Feb 9 14:56:23 2008 +0000
711 [perl #49472] Attributes + Unknown Error
716 You can peek into the bisecting process with C<git bisect log> and
717 C<git bisect visualize>. C<git bisect reset> will get you out of bisect
720 Please note that the first C<good> state must be an ancestor of the
721 first C<bad> state. If you want to search for the commit that I<solved>
722 some bug, you have to negate your test case (i.e. exit with C<1> if OK
723 and C<0> if not) and still mark the lower bound as C<good> and the
724 upper as C<bad>. The "first bad commit" has then to be understood as
725 the "first commit where the bug is solved".
727 C<git help bisect> has much more information on how you can tweak your
730 =head1 Submitting a patch via GitHub
732 GitHub is a website that makes it easy to fork and publish projects
733 with Git. First you should set up a GitHub account and log in.
735 Perl's git repository is mirrored on GitHub at this page:
737 http://github.com/mirrors/perl/tree/blead
739 Visit the page and click the "fork" button. This clones the Perl git
740 repository for you and provides you with "Your Clone URL" from which
743 % git clone git@github.com:USERNAME/perl.git perl-github
745 The same patch as above, using github might look like this:
748 % git remote add upstream git://perl5.git.perl.org/perl.git
749 % git pull upstream blead
750 % git checkout -b orange
751 % perl -pi -e 's{Leon Brocard}{Orange Brocard}' AUTHORS
752 % git commit -a -m 'Rename Leon Brocard to Orange Brocard'
753 % git push origin orange
755 The orange branch has been pushed to GitHub, so you should now send an
756 email (see L</Submitting a patch>) with a description of your changes
757 and the following information:
759 http://github.com/USERNAME/perl/tree/orange
760 git://github.com/USERNAME/perl.git branch orange
762 =head1 Merging from a branch via GitHub
764 If someone has provided a branch via GitHub and you are a committer,
765 you should use the following in your perl-ssh directory:
767 % git remote add avar git://github.com/avar/perl.git
770 Now you can see the differences between the branch and blead:
772 % git diff avar/orange
774 And you can see the commits:
776 % git log avar/orange
778 If you approve of a specific commit, you can cherry pick it:
780 % git cherry-pick 0c24b290ae02b2ab3304f51d5e11e85eb3659eae
782 Or you could just merge the whole branch if you like it all:
784 % git merge avar/orange
786 And then push back to the repository:
791 =head1 Topic branches and rewriting history
793 Individual committers should create topic branches under
794 B<yourname>/B<some_descriptive_name>. Other committers should check
795 with a topic branch's creator before making any change to it.
797 The simplest way to create a remote topic branch that works on all
798 versions of git is to push the current head as a new branch on the
799 remote, then check it out locally:
801 $ branch="$yourname/$some_descriptive_name"
802 $ git push origin HEAD:$branch
803 $ git checkout -b $branch origin/$branch
805 Users of git 1.7 or newer can do it in a more obvious manner:
807 $ branch="$yourname/$some_descriptive_name"
808 $ git checkout -b $branch
809 $ git push origin -u $branch
811 If you are not the creator of B<yourname>/B<some_descriptive_name>, you
812 might sometimes find that the original author has edited the branch's
813 history. There are lots of good reasons for this. Sometimes, an author
814 might simply be rebasing the branch onto a newer source point.
815 Sometimes, an author might have found an error in an early commit which
816 they wanted to fix before merging the branch to blead.
818 Currently the master repository is configured to forbid
819 non-fast-forward merges. This means that the branches within can not
820 be rebased and pushed as a single step.
822 The only way you will ever be allowed to rebase or modify the history
823 of a pushed branch is to delete it and push it as a new branch under
824 the same name. Please think carefully about doing this. It may be
825 better to sequentially rename your branches so that it is easier for
826 others working with you to cherry-pick their local changes onto the new
827 version. (XXX: needs explanation).
829 If you want to rebase a personal topic branch, you will have to delete
830 your existing topic branch and push as a new version of it. You can do
831 this via the following formula (see the explanation about C<refspec>'s
832 in the git push documentation for details) after you have rebased your
836 $ git checkout $user/$topic
838 $ git rebase origin/blead
840 # then "delete-and-push"
841 $ git push origin :$user/$topic
842 $ git push origin $user/$topic
844 B<NOTE:> it is forbidden at the repository level to delete any of the
845 "primary" branches. That is any branch matching
846 C<m!^(blead|maint|perl)!>. Any attempt to do so will result in git
847 producing an error like this:
849 $ git push origin :blead
850 *** It is forbidden to delete blead/maint branches in this repository
851 error: hooks/update exited with error code 1
852 error: hook declined to update refs/heads/blead
853 To ssh://perl5.git.perl.org/perl
854 ! [remote rejected] blead (hook declined)
855 error: failed to push some refs to 'ssh://perl5.git.perl.org/perl'
857 As a matter of policy we do B<not> edit the history of the blead and
858 maint-* branches. If a typo (or worse) sneaks into a commit to blead or
859 maint-*, we'll fix it in another commit. The only types of updates
860 allowed on these branches are "fast-forward's", where all history is
863 Annotated tags in the canonical perl.git repository will never be
864 deleted or modified. Think long and hard about whether you want to push
865 a local tag to perl.git before doing so. (Pushing unannotated tags is
868 =head1 Committing to maintenance versions
870 Maintenance versions should only be altered to add critical bug
871 fixes, see L<perlpolicy>.
873 To commit to a maintenance version of perl, you need to create a local
876 % git checkout --track -b maint-5.005 origin/maint-5.005
878 This creates a local branch named C<maint-5.005>, which tracks the
879 remote branch C<origin/maint-5.005>. Then you can pull, commit, merge
882 You can also cherry-pick commits from blead and another branch, by
883 using the C<git cherry-pick> command. It is recommended to use the
884 B<-x> option to C<git cherry-pick> in order to record the SHA1 of the
885 original commit in the new commit message.
889 The perl history contains one mistake which was not caught in the
890 conversion: a merge was recorded in the history between blead and
891 maint-5.10 where no merge actually occurred. Due to the nature of git,
892 this is now impossible to fix in the public repository. You can remove
893 this mis-merge locally by adding the following line to your
894 C<.git/info/grafts> file:
896 296f12bbbbaa06de9be9d09d3dcf8f4528898a49 434946e0cb7a32589ed92d18008aaa1d88515930
898 It is particularly important to have this graft line if any bisecting
899 is done in the area of the "merge" in question.
907 The git documentation, accessible via the C<git help> command
911 L<perlpolicy> - Perl core development policy