5.14.1

名前

perlgit - Detailed information about git and the Perl repository

perlgit - git と Perl リポジトリに関する詳細情報

説明

This document provides details on using git to develop Perl. If you are just interested in working on a quick patch, see perlhack first. This document is intended for people who are regular contributors to Perl, including those with write access to the git repository.

この文書は、Perl を開発するために git を使う詳細を提供します。 単に簡単なパッチに対して作業することに興味があるなら、 まず perlhack を参照してください。 この文書は、git リポジトリへの書き込みアクセスを持つ人々を含む、 Perl の定期的な貢献者である人々のためを意図しています。

リポジトリをクローンする

All of Perl's source code is kept centrally in a Git repository at perl5.git.perl.org.

Perlのソースコードはすべて、perl5.git.perl.org の Git リポジトリに 集中管理されています。

You can make a read-only clone of the repository by running:

これを実行することでリポジトリの読み込み専用のクローンを作ることができます:

  % git clone git://perl5.git.perl.org/perl.git perl

This uses the git protocol (port 9418).

これは git プロトコル (ポート 9418) を使います。

If you cannot use the git protocol for firewall reasons, you can also clone via http, though this is much slower:

ファイアウォールの関係で git プロトコルが使えない場合、 http 経由でもクローンできますが、はるかに遅いです:

  % git clone http://perl5.git.perl.org/perl.git perl

リポジトリでの作業

Once you have changed into the repository directory, you can inspect it. After a clone the repository will contain a single local branch, which will be the current branch as well, as indicated by the asterisk.

リポジトリディレクトリに変更を加えたら、そのディレクトリを検査できます。 クローン作成後、リポジトリには単一のローカルブランチが含まれます。 このローカルブランチは、アスタリスクで示されているように、 現在のブランチにもなります。

  % git branch
  * blead

Using the -a switch to branch will also show the remote tracking branches in the repository:

branch に -a スイッチを使用すると、リポジトリ内の リモート追跡ブランチも表示されます:

  % git branch -a
  * blead
    origin/HEAD
    origin/blead
  ...

The branches that begin with "origin" correspond to the "git remote" that you cloned from (which is named "origin"). Each branch on the remote will be exactly tracked by theses branches. You should NEVER do work on these remote tracking branches. You only ever do work in a local branch. Local branches can be configured to automerge (on pull) from a designated remote tracking branch. This is the case with the default branch blead which will be configured to merge from the remote tracking branch origin/blead.

"origin" で始まるブランチは、クローン元の "git remote" ("origin" という名前) に対応します。 リモートの各ブランチは、これらのブランチによって正確に追跡されます。 これらのリモート追跡ブランチでは絶対に作業しないでください。 ローカルブランチでのみ作業します。 ローカルブランチは、指定されたリモート追跡ブランチから (プル時に)自動マージするように構成できます。 これは、リモート追跡ブランチ origin/blead からマージするように 構成されているデフォルトブランチ blead の場合です。

You can see recent commits:

最近のコミットを見られます:

  % git log

And pull new changes from the repository, and update your local repository (must be clean first)

リポジトリから新しい変更をプルし、ローカルリポジトリを更新します (最初にクリーンにする必要があります)。

  % git pull

Assuming we are on the branch blead immediately after a pull, this command would be more or less equivalent to:

プルの直後にブランチ blead にいると仮定すると、このコマンドは 以下とほぼ等価になります:

  % git fetch
  % git merge origin/blead

In fact if you want to update your local repository without touching your working directory you do:

実際、作業ディレクトリにアクセスせずにローカルリポジトリを更新したい場合は、 次のようにします:

  % git fetch

And if you want to update your remote-tracking branches for all defined remotes simultaneously you can do

また、定義されたすべてのリモートに対してリモート追跡ブランチを 同時に更新したい場合は、以下のように行うことができます:

  % git remote update

Neither of these last two commands will update your working directory, however both will update the remote-tracking branches in your repository.

最後の二つのコマンドはどちらも作業ディレクトリを更新しませんが、どちらも リポジトリ内のリモート追跡ブランチを更新します。

To make a local branch of a remote branch:

リモートブランチのローカルブランチを作るには:

  % git checkout -b maint-5.10 origin/maint-5.10

To switch back to blead:

blead に戻るには:

  % git checkout blead

現在の状態を確認する

The most common git command you will use will probably be

おそらくもっともよく使う git コマンドは:

  % git status

This command will produce as output a description of the current state of the repository, including modified files and unignored untracked files, and in addition it will show things like what files have been staged for the next commit, and usually some useful information about how to change things. For instance the following:

このコマンドは、変更されたファイルや無視されていない 追跡されていないファイルなど、リポジトリの現在の状態の説明を 出力として生成します。 さらに、次のコミットのためにステージングされたファイルや、 通常は変更方法に関する有用な情報を表示します。 たとえば、次のようになります:

  $ git status
  # On branch blead
  # Your branch is ahead of 'origin/blead' by 1 commit.
  #
  # Changes to be committed:
  #   (use "git reset HEAD <file>..." to unstage)
  #
  #       modified:   pod/perlgit.pod
  #
  # Changed but not updated:
  #   (use "git add <file>..." to update what will be committed)
  #
  #       modified:   pod/perlgit.pod
  #
  # Untracked files:
  #   (use "git add <file>..." to include in what will be committed)
  #
  #       deliberate.untracked

This shows that there were changes to this document staged for commit, and that there were further changes in the working directory not yet staged. It also shows that there was an untracked file in the working directory, and as you can see shows how to change all of this. It also shows that there is one commit on the working branch blead which has not been pushed to the origin remote yet. NOTE: that this output is also what you see as a template if you do not provide a message to git commit.

これは、コミットのためにステージングされたこの文書に変更があったことと、 まだステージングされていないワーキングディレクトリに さらに変更があったことを示しています。 また、ワーキングディレクトリに追跡されていないファイルが あったことも示しています; また、これらすべてを変更する方法を示しています。 また、origin リモートにまだプッシュされていないワーキングブランチ blead に一つのコミットがあることも示しています。 : この出力は、git commit にメッセージを提供しない場合に テンプレートとして表示されるものでもあります。

パッチのワークフロー

First, please read perlhack for details on hacking the Perl core. That document covers many details on how to create a good patch.

まず、Perl コアをハックするための詳細については perlhack を読んでください。 この文書はよいパッチの作り方に関する多くの詳細に対応しています。

If you already have a Perl repository, you should ensure that you're on the blead branch, and your repository is up to date:

すでに Perl リポジトリを持っている場合は、 blead ブランチにいて、リポジトリが最新であることを確認する必要があります:

  % git checkout blead
  % git pull

It's preferable to patch against the latest blead version, since this is where new development occurs for all changes other than critical bug fixes. Critical bug fix patches should be made against the relevant maint branches, or should be submitted with a note indicating all the branches where the fix should be applied.

最新の blead バージョンに対してパッチを適用することをお勧めします。 これは、重大なバグ修正以外のすべての変更に対して新たな開発が行われる 場所であるためです。 重大なバグ修正パッチは、関連するメインブランチに対して作成するか、 修正が適用されるすべてのブランチを示すメモとともに提出する必要があります。

Now that we have everything up to date, we need to create a temporary new branch for these changes and switch into it:

すべてが最新の状態になったので、これらの変更に対して一時的な 新しいブランチを作成し、そのブランチに切り替える必要があります:

  % git checkout -b orange

which is the short form of

これは以下のものの短縮形です

  % git branch orange
  % git checkout orange

Creating a topic branch makes it easier for the maintainers to rebase or merge back into the master blead for a more linear history. If you don't work on a topic branch the maintainer has to manually cherry pick your changes onto blead before they can be applied.

トピックブランチを作成することで、メンテナはよりリニアな履歴のために master blead にリベースまたはマージバックすることが簡単になります。 トピックブランチで作業しない場合、 メンテナは変更を適用する前に手動で blead にチェリーピックする 必要があります。

That'll get you scolded on perl5-porters, so don't do that. Be Awesome.

perl5-porters で叱られることになるので、そんなことはしないでください。 うまくやりましょう。

Then make your changes. For example, if Leon Brocard changes his name to Orange Brocard, we should change his name in the AUTHORS file:

次に、変更を加えます。 たとえば、Leon Brocard が名前を Orange Brocard に変更した場合、 AUTHORS ファイル内の名前を変更する必要があります:

  % perl -pi -e 's{Leon Brocard}{Orange Brocard}' AUTHORS

You can see what files are changed:

どのファイルを変更したかを見られます:

  % git status
  # On branch orange
  # Changes to be committed:
  #   (use "git reset HEAD <file>..." to unstage)
  #
  #    modified:   AUTHORS
  #

And you can see the changes:

そして変更が見られます:

  % git diff
  diff --git a/AUTHORS b/AUTHORS
  index 293dd70..722c93e 100644
  --- a/AUTHORS
  +++ b/AUTHORS
  @@ -541,7 +541,7 @@    Lars Hecking                   <lhecking@nmrc.ucc.ie>
   Laszlo Molnar                  <laszlo.molnar@eth.ericsson.se>
   Leif Huhn                      <leif@hale.dkstat.com>
   Len Johnson                    <lenjay@ibm.net>
  -Leon Brocard                   <acme@astray.com>
  +Orange Brocard                 <acme@astray.com>
   Les Peters                     <lpeters@aol.net>
   Lesley Binks                   <lesley.binks@gmail.com>
   Lincoln D. Stein               <lstein@cshl.org>

Now commit your change locally:

ここで変更をローカルにコミットします:

  % git commit -a -m 'Rename Leon Brocard to Orange Brocard'
  Created commit 6196c1d: Rename Leon Brocard to Orange Brocard
   1 files changed, 1 insertions(+), 1 deletions(-)

The -a option is used to include all files that git tracks that you have changed. If at this time, you only want to commit some of the files you have worked on, you can omit the -a and use the command git add FILE ... before doing the commit. git add --interactive allows you to even just commit portions of files instead of all the changes in them.

-a オプションは、git が追跡しているファイルの中であなたが変更した 全てのファイルを含むために使われます。 もしこの時点で、作業したファイルの一部だけをコミットしたい場合は、 -a を省略して、コミットを行う前にコマンド git add FILE ... を使ってください。 git add --interactive は、ファイル中の全ての変更ではなく、 ファイルの一部をコミットできるようにします。

The -m option is used to specify the commit message. If you omit it, git will open a text editor for you to compose the message interactively. This is useful when the changes are more complex than the sample given here, and, depending on the editor, to know that the first line of the commit message doesn't exceed the 50 character legal maximum.

-m オプションはコミットメッセージを指定するために使われます。 これを省略すると、git はメッセージを対話的に作成するために テキストエディタを開きます。 これは、変更がここで指定するサンプルよりも複雑な場合、そして エディタによっては、コミットメッセージの先頭行が上限の 50 文字を超えないことを知るために有用です。

Once you've finished writing your commit message and exited your editor, git will write your change to disk and tell you something like this:

コミットメッセージを書き終えてエディタを終了すると、 git は変更をディスクに書き込み、以下のようなメッセージを出力します:

  Created commit daf8e63: explain git status and stuff about remotes
   1 files changed, 83 insertions(+), 3 deletions(-)

If you re-run git status, you should see something like this:

git status を再実行すると、次のようなものが表示されます:

  % git status
  # On branch blead
  # Your branch is ahead of 'origin/blead' by 2 commits.
  #
  # Untracked files:
  #   (use "git add <file>..." to include in what will be committed)
  #
  #       deliberate.untracked
  nothing added to commit but untracked files present (use "git add" to track)

When in doubt, before you do anything else, check your status and read it carefully, many questions are answered directly by the git status output.

疑わしいときには、他のことをする前に、ステータスをチェックして 注意深く読んでください; 多くの疑問は git status の出力で直接応えられています。

You can examine your last commit with:

最後のコミットを以下のようにして検査できます:

  % git show HEAD

and if you are not happy with either the description or the patch itself you can fix it up by editing the files once more and then issue:

説明またはパッチ自体に満足できない場合は、ファイルをもう一度編集してから 次のコマンドを発行することで修正できます:

  % git commit -a --amend

Now you should create a patch file for all your local changes:

ここで全てのローカルな変更のためのパッチファイルを作るべきです:

  % git format-patch -M origin..
  0001-Rename-Leon-Brocard-to-Orange-Brocard.patch

You should now send an email to to perlbug@perl.org with a description of your changes, and include this patch file as an attachment. In addition to being tracked by RT, mail to perlbug will automatically be forwarded to perl5-porters (with manual moderation, so please be patient). You should only send patches to perl5-porters@perl.org directly if the patch is not ready to be applied, but intended for discussion.

perlbug@perl.org 宛に変更内容を記載した メールを送信し、このパッチファイルを添付ファイルとして送ってください。 RT で追跡することに加えて、 perlbug にメールすると、自動的に perl5-porters に (手動のモデレーションの後、従って気長に待ってください) 転送されます。 パッチは適用する準備ができていない状態だけれども議論したい場合は、 perl5-porters@perl.org だけに 直接メールを送るべきです。

See the next section for how to configure and use git to send these emails for you.

これらのメールを送信するために git を設定して使う方法については、 次の節を参照してください。

If you want to delete your temporary branch, you may do so with:

一時的なブランチを削除したいなら、以下のようにできます:

  % git checkout blead
  % git branch -d orange
  error: The branch 'orange' is not an ancestor of your current HEAD.
  If you are sure you want to delete it, run 'git branch -D orange'.
  % git branch -D orange
  Deleted branch orange.

変更をコミットする

Assuming that you'd like to commit all the changes you've made as a single atomic unit, run this command:

今行ったすべての変更を一つのアトミックユニットとしてコミットしたい場合は、 次のコマンドを実行します:

   % git commit -a

(That -a tells git to add every file you've changed to this commit. New files aren't automatically added to your commit when you use commit -a If you want to add files or to commit some, but not all of your changes, have a look at the documentation for git add.)

(-a は git に対して、変更したすべてのファイルをこのコミットに 追加するように指示します。 commit -a を使用しても、新しいファイルは自動的にコミットに追加されません。 ファイルを追加したい場合や、一部の変更をコミットしたい場合は、 git add の文書を参照してください。

Git will start up your favorite text editor, so that you can craft a commit message for your change. See "Commit message" in perlhack for more information about what makes a good commit message.

Git は、あなたが変更内容のコミットメッセージを作成できるように、 お気に入りのテキストエディタを起動します。 適切なコミットメッセージを作成する方法に関するさらなる情報については、 "Commit message" を参照してください。

Once you've finished writing your commit message and exited your editor, git will write your change to disk and tell you something like this:

コミットメッセージを書き終えてエディタを終了すると、 git は変更をディスクに書き込み、以下のようなメッセージを出力します:

  Created commit daf8e63: explain git status and stuff about remotes
   1 files changed, 83 insertions(+), 3 deletions(-)

If you re-run git status, you should see something like this:

git status を再実行すると、次のようなものが表示されます:

  % git status
  # On branch blead
  # Your branch is ahead of 'origin/blead' by 2 commits.
  #
  # Untracked files:
  #   (use "git add <file>..." to include in what will be committed)
  #
  #       deliberate.untracked
  nothing added to commit but untracked files present (use "git add" to track)

When in doubt, before you do anything else, check your status and read it carefully, many questions are answered directly by the git status output.

何か疑問がある場合には、何かをする前に自分のステータスをチェックして 注意深く読んでください; 多くの疑問に対しては、git status 出力が直接答えてくれます。

パッチをメールするのに git を使う

Please read perlhack first in order to figure out where your patches should be sent.

パッチをどこに送るべきかを知るためには、まず perlhack を読んでください。

In your ~/git/perl repository, set the destination email to perl's bug tracker:

~/git/perl リポジトリで、宛先メールを perl のバグトラッカーに 設定します。

  $ git config sendemail.to perlbug@perl.org

Or maybe perl5-porters:

またはおそらく perl5-porters:

  $ git config sendemail.to perl5-porters@perl.org

Then you can use git directly to send your patch emails:

その後、git を直接使ってパッチメールを送ることができます:

  $ git send-email 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch

You may need to set some configuration variables for your particular email service provider. For example, to set your global git config to send email via a gmail account:

特定の電子メールサービスプロバイダに対していくつかの設定変数を設定する 必要があるかもしれません。 例えば、gmail アカウント経由で電子メールを送信するように グローバル git を設定するには:

  $ git config --global sendemail.smtpserver smtp.gmail.com
  $ git config --global sendemail.smtpssl 1
  $ git config --global sendemail.smtpuser YOURUSERNAME@gmail.com

With this configuration, you will be prompted for your gmail password when you run 'git send-email'. You can also configure sendemail.smtppass with your password if you don't care about having your password in the .gitconfig file.

この設定では、'git send-email' を実行するときに gmail パスワードの入力を求められます。 .gitconfig ファイルにパスワードを保存したくない場合は、 sendemail.smtppass にパスワードを設定することもできます。

派生ファイルに関する注意

Be aware that many files in the distribution are derivative--avoid patching them, because git won't see the changes to them, and the build process will overwrite them. Patch the originals instead. Most utilities (like perldoc) are in this category, i.e. patch utils/perldoc.PL rather than utils/perldoc. Similarly, don't create patches for files under $src_root/ext from their copies found in $install_root/lib. If you are unsure about the proper location of a file that may have gotten copied while building the source distribution, consult the MANIFEST.

ディストリビューション内の多くのファイルは 派生的なものであることに注意してください -- それらのファイルにパッチを当てることは避けてください; なぜなら、git はそれらに対する変更を見ることができず、 ビルドプロセスがそれらを上書きするからです。 代わりにオリジナルにパッチを当ててください。 ほとんどのユーティリティ(perldoc など)はこのカテゴリにあります; すなわち、utils/perldoc ではなく utils/perldoc.PL にパッチを当てます。 同様に、$install_root/lib にあるコピーから $src_root/ext 以下のファイルに パッチを作成しないでください。 ソースディストリビューションのビルド中にコピーされた可能性のあるファイルの 適切な場所がわからない場合は、MANIFEST を調べてください。

作業ディレクトリを掃除する

The command git clean can with varying arguments be used as a replacement for make clean.

git clean コマンドはさまざまな引数で make clean の代わりに 使うことができます。

To reset your working directory to a pristine condition you can do:

作業ディレクトリを初期状態にリセットするには、次のようにします:

  % git clean -dxf

However, be aware this will delete ALL untracked content. You can use

ただし、これによりすべての追跡されていないコンテンツが削除されます。 次のようにすると:

  % git clean -Xf

to remove all ignored untracked files, such as build and test byproduct, but leave any manually created files alone.

ビルドやテストの副産物など、すべての無視された 追跡されていないファイルを削除します。 ただし、手動で作成したファイルは残します。

If you only want to cancel some uncommitted edits, you can use git checkout and give it a list of files to be reverted, or git checkout -f to revert them all.

コミットされていない編集だけをキャンセルしたい場合は、 git checkout を使用して元に戻すファイルのリストを与えるか、 git checkout -f を使用してすべてを元に戻すことができます。

If you want to cancel one or several commits, you can use git reset.

1つまたは複数のコミットをキャンセルしたい場合は、git reset を 使うことができます。

bisect

git provides a built-in way to determine, with a binary search in the history, which commit should be blamed for introducing a given bug.

git には、履歴の二分検索を使って、どのコミットが特定のバグを 引き起こしたと非難されるべきかを判断する手段が組み込まれています。

Suppose that we have a script ~/testcase.pl that exits with 0 when some behaviour is correct, and with 1 when it's faulty. You need an helper script that automates building perl and running the testcase:

スクリプト ~/testcase.pl があり、動作が正しい場合は 0 で終了し、 動作が正しくない場合は 1 で終了するとします。 perl の構築とテストケースの実行を自動化するヘルパースクリプトが必要です:

  % cat ~/run
  #!/bin/sh
  git clean -dxf

  # If you get './makedepend: 1: Syntax error: Unterminated quoted
  # string' when bisecting versions of perl older than 5.9.5 this hack
  # will work around the bug in makedepend.SH which was fixed in
  # version 96a8704c. Make sure to comment out `git checkout makedepend.SH'
  # below too.
  git show blead:makedepend.SH > makedepend.SH

  # If you can use ccache, add -Dcc=ccache\ gcc -Dld=gcc to the Configure line
  # if Encode is not needed for the test, you can speed up the bisect by
  # excluding it from the runs with -Dnoextensions=Encode
  sh Configure -des -Dusedevel -Doptimize="-g"
  test -f config.sh || exit 125
  # Correct makefile for newer GNU gcc
  perl -ni -we 'print unless /<(?:built-in|command)/' makefile x2p/makefile
  # if you just need miniperl, replace test_prep with miniperl
  make test_prep
  [ -x ./perl ] || exit 125
  ./perl -Ilib ~/testcase.pl
  ret=$?
  [ $ret -gt 127 ] && ret=127
  # git checkout makedepend.SH
  git clean -dxf
  exit $ret

This script may return 125 to indicate that the corresponding commit should be skipped. Otherwise, it returns the status of ~/testcase.pl.

このスクリプトは、対応するコミットをスキップすることを示す 125 を 返す場合があります。 それ以外の場合は、~/testcase.plのステータスを返します。

You first enter in bisect mode with:

まず bisect モードに入ります:

  % git bisect start

For example, if the bug is present on HEAD but wasn't in 5.10.0, git will learn about this when you enter:

例えば、バグが HEAD にあっても 5.10.0 にはなかった場合、git は 以下のように入力することでこれを学習します:

  % git bisect bad
  % git bisect good perl-5.10.0
  Bisecting: 853 revisions left to test after this

This results in checking out the median commit between HEAD and perl-5.10.0. You can then run the bisecting process with:

この結果、HEADperl-5.10.0 の中間のコミットが チェックアウトされます。 次のようにして bisect 処理を実行します:

  % git bisect run ~/run

When the first bad commit is isolated, git bisect will tell you so:

最初の不正なコミットが分離されると、git bisect は次のように言います:

  ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5 is first bad commit
  commit ca4cfd28534303b82a216cfe83a1c80cbc3b9dc5
  Author: Dave Mitchell <davem@fdisolutions.com>
  Date:   Sat Feb 9 14:56:23 2008 +0000

      [perl #49472] Attributes + Unknown Error
      ...

  bisect run success

You can peek into the bisecting process with git bisect log and git bisect visualize. git bisect reset will get you out of bisect mode.

git bisect loggit bisect visualize で bisect 処理を 覗き見ることができます。 git bisect resetは bisect モードを解除します。

Please note that the first good state must be an ancestor of the first bad state. If you want to search for the commit that solved some bug, you have to negate your test case (i.e. exit with 1 if OK and 0 if not) and still mark the lower bound as good and the upper as bad. The "first bad commit" has then to be understood as the "first commit where the bug is solved".

最初の good 状態は、最初の bad 状態の祖先である必要があることに 注意してください。 何らかのバグを 解決した コミットを検索したい場合は、テストケースを 反転させ、 (つまり、OK なら 1 で終了し、そうでないなら 0 で終了する)、 下限を good、上限を bad とマークする必要があります。 「最初の不正なコミット」は、「バグが解決された最初のコミット」と 解釈する必要があります。

git help bisect has much more information on how you can tweak your binary searches.

git help bisect には、二分探索を微調整する方法に関する情報が豊富に 用意されています。

トピックブランチと履歴の書き換え

Individual committers should create topic branches under yourname/some_descriptive_name. Other committers should check with a topic branch's creator before making any change to it.

個々のコミッターは、yourname/some_descriptive_name の下にトピックブランチを作成する必要があります。 他のコミッターは、トピックブランチに変更を加える前に、その作成者に 確認する必要があります。

The simplest way to create a remote topic branch that works on all versions of git is to push the current head as a new branch on the remote, then check it out locally:

すべてのバージョンの git で動作する、リモートトピックブランチを作成する 最も簡単な方法は、現在の head をリモートの新しいブランチとしてプッシュし、 ローカルでチェックアウトすることです。

  $ branch="$yourname/$some_descriptive_name"
  $ git push origin HEAD:$branch
  $ git checkout -b $branch origin/$branch

Users of git 1.7 or newer can do it in a more obvious manner:

git 1.7 以降のユーザは、もっと明らかな方法を使うことが出来ます:

  $ branch="$yourname/$some_descriptive_name"
  $ git checkout -b $branch
  $ git push origin -u $branch

If you are not the creator of yourname/some_descriptive_name, you might sometimes find that the original author has edited the branch's history. There are lots of good reasons for this. Sometimes, an author might simply be rebasing the branch onto a newer source point. Sometimes, an author might have found an error in an early commit which they wanted to fix before merging the branch to blead.

yourname/some_descriptive_name の作成者でない場合、元の作成者が ブランチの履歴を編集したことに気付くことがあります。 これには多くの正当な理由があります。 場合によっては、単にブランチを新しいソースポイントに基づいて 作り直すことになることもあります。 場合によっては、ブランチを blead にマージする前に、 初期のコミットで修正したいエラーを見つけたこともあります。

Currently the master repository is configured to forbid non-fast-forward merges. This means that the branches within can not be rebased and pushed as a single step.

現在、マスターリポジトリは、非 fast-forward のマージを禁止するように 構成されています。 これは、中のブランチはリベースとプッシュを単一ステップとしては できないことを意味します。

The only way you will ever be allowed to rebase or modify the history of a pushed branch is to delete it and push it as a new branch under the same name. Please think carefully about doing this. It may be better to sequentially rename your branches so that it is easier for others working with you to cherry-pick their local changes onto the new version. (XXX: needs explanation).

プッシュされたブランチの履歴を再取得または変更する唯一の方法は、 そのブランチを削除し、同じ名前で新しいブランチとしてプッシュすることです。 これを行うことについては慎重に検討してください。 他のユーザーが新しいバージョンにローカルの変更を簡単に チェリーピックできるように、 ブランチの名前を順番に変更した方がよい場合があります(XXX:説明が必要)。

If you want to rebase a personal topic branch, you will have to delete your existing topic branch and push as a new version of it. You can do this via the following formula (see the explanation about refspec's in the git push documentation for details) after you have rebased your branch:

個人的なトピックブランチをリベースしたい場合は、 既存のトピックブランチを削除し、新しいバージョンとして プッシュする必要があります。 これは、ブランチをリベースした後、次の公式 (詳細は git push 文書の refspec に関する説明を参照)で行うことができます。

   # first rebase
   $ git checkout $user/$topic
   $ git fetch
   $ git rebase origin/blead

   # then "delete-and-push"
   $ git push origin :$user/$topic
   $ git push origin $user/$topic

NOTE: it is forbidden at the repository level to delete any of the "primary" branches. That is any branch matching m!^(blead|maint|perl)!. Any attempt to do so will result in git producing an error like this:

注意: リポジトリレベルで"プライマリ"ブランチを削除することは 禁止されています。 これは m!^(blead maint perl)! にマッチングするブランチです。 削除しようとすると、gitは次のようなエラーを生成します:

    $ git push origin :blead
    *** It is forbidden to delete blead/maint branches in this repository
    error: hooks/update exited with error code 1
    error: hook declined to update refs/heads/blead
    To ssh://perl5.git.perl.org/perl
     ! [remote rejected] blead (hook declined)
     error: failed to push some refs to 'ssh://perl5.git.perl.org/perl'

As a matter of policy we do not edit the history of the blead and maint-* branches. If a typo (or worse) sneaks into a commit to blead or maint-*, we'll fix it in another commit. The only types of updates allowed on these branches are "fast-forward's", where all history is preserved.

ポリシーとして、blead ブランチと maint-* ブランチの履歴は編集 しません。 タイプミス(またはそれ以上)が blead または maint-* へのコミットに 忍び込んだ場合は、別のコミットで修正します。 これらのブランチで許可されている更新のタイプは "fast-forward" だけで、 すべての履歴が保存されます。

Annotated tags in the canonical perl.git repository will never be deleted or modified. Think long and hard about whether you want to push a local tag to perl.git before doing so. (Pushing unannotated tags is not allowed.)

標準的な perl.git リポジトリ内の注釈付きタグは、削除や 変更されることはありません。 ローカルタグを perl.git にプッシュする前に、じっくり考えてみてください (注釈なしタグのプッシュは許可されていません)。

接ぎ木

The perl history contains one mistake which was not caught in the conversion: a merge was recorded in the history between blead and maint-5.10 where no merge actually occurred. Due to the nature of git, this is now impossible to fix in the public repository. You can remove this mis-merge locally by adding the following line to your .git/info/grafts file:

Perl履歴には、変換で検出されなかった誤りが一つ含まれています: blead と maint-5.10 の間の履歴にマージが記録されましたが、 実際にはマージは発生しませんでした。 git の性質上、パブリックリポジトリで修正することは現在不可能です。 .git/info/graft ファイルに次の行を追加することで、 この誤ったマージをローカルで削除できます。

  296f12bbbbaa06de9be9d09d3dcf8f4528898a49 434946e0cb7a32589ed92d18008aaa1d88515930

It is particularly important to have this graft line if any bisecting is done in the area of the "merge" in question.

問題の「マージ」領域で bisect が行われる場合、この graft 行を 指定することが特に重要です。

トピックブランチと履歴の書き換え

Individual committers should create topic branches under yourname/some_descriptive_name. Other committers should check with a topic branch's creator before making any change to it.

個々のコミッターは、yourname/some_descriptive_name の下にトピックブランチを作成する必要があります。 他のコミッターは、トピックブランチに変更を加える前に、その作成者に 確認する必要があります。

The simplest way to create a remote topic branch that works on all versions of git is to push the current head as a new branch on the remote, then check it out locally:

すべてのバージョンの git で動作する、リモートトピックブランチを作成する 最も簡単な方法は、現在の head をリモートの新しいブランチとしてプッシュし、 ローカルでチェックアウトすることです。

  $ branch="$yourname/$some_descriptive_name"
  $ git push origin HEAD:$branch
  $ git checkout -b $branch origin/$branch

Users of git 1.7 or newer can do it in a more obvious manner:

git 1.7 以降のユーザは、もっと明らかな方法を使うことが出来ます:

  $ branch="$yourname/$some_descriptive_name"
  $ git checkout -b $branch
  $ git push origin -u $branch

If you are not the creator of yourname/some_descriptive_name, you might sometimes find that the original author has edited the branch's history. There are lots of good reasons for this. Sometimes, an author might simply be rebasing the branch onto a newer source point. Sometimes, an author might have found an error in an early commit which they wanted to fix before merging the branch to blead.

yourname/some_descriptive_name の作成者でない場合、元の作成者が ブランチの履歴を編集したことに気付くことがあります。 これには多くの正当な理由があります。 場合によっては、単にブランチを新しいソースポイントに基づいて 作り直すことになることもあります。 場合によっては、ブランチを blead にマージする前に、 初期のコミットで修正したいエラーを見つけたこともあります。

Currently the master repository is configured to forbid non-fast-forward merges. This means that the branches within can not be rebased and pushed as a single step.

現在、マスターリポジトリは、非 fast-forward のマージを禁止するように 構成されています。 これは、中のブランチはリベースとプッシュを単一ステップとしては できないことを意味します。

The only way you will ever be allowed to rebase or modify the history of a pushed branch is to delete it and push it as a new branch under the same name. Please think carefully about doing this. It may be better to sequentially rename your branches so that it is easier for others working with you to cherry-pick their local changes onto the new version. (XXX: needs explanation).

プッシュされたブランチの履歴を再取得または変更する唯一の方法は、 そのブランチを削除し、同じ名前で新しいブランチとしてプッシュすることです。 これを行うことについては慎重に検討してください。 他のユーザーが新しいバージョンにローカルの変更を簡単に チェリーピックできるように、 ブランチの名前を順番に変更した方がよい場合があります(XXX:説明が必要)。

If you want to rebase a personal topic branch, you will have to delete your existing topic branch and push as a new version of it. You can do this via the following formula (see the explanation about refspec's in the git push documentation for details) after you have rebased your branch:

個人的なトピックブランチをリベースしたい場合は、 既存のトピックブランチを削除し、新しいバージョンとして プッシュする必要があります。 これは、ブランチをリベースした後、次の公式 (詳細は git push 文書の refspec に関する説明を参照)で行うことができます。

   # first rebase
   $ git checkout $user/$topic
   $ git fetch
   $ git rebase origin/blead

   # then "delete-and-push"
   $ git push origin :$user/$topic
   $ git push origin $user/$topic

NOTE: it is forbidden at the repository level to delete any of the "primary" branches. That is any branch matching m!^(blead|maint|perl)!. Any attempt to do so will result in git producing an error like this:

注意: リポジトリレベルで"プライマリ"ブランチを削除することは 禁止されています。 これは m!^(blead maint perl)! にマッチングするブランチです。 削除しようとすると、gitは次のようなエラーを生成します:

    $ git push origin :blead
    *** It is forbidden to delete blead/maint branches in this repository
    error: hooks/update exited with error code 1
    error: hook declined to update refs/heads/blead
    To ssh://perl5.git.perl.org/perl
     ! [remote rejected] blead (hook declined)
     error: failed to push some refs to 'ssh://perl5.git.perl.org/perl'

As a matter of policy we do not edit the history of the blead and maint-* branches. If a typo (or worse) sneaks into a commit to blead or maint-*, we'll fix it in another commit. The only types of updates allowed on these branches are "fast-forward's", where all history is preserved.

ポリシーとして、blead ブランチと maint-* ブランチの履歴は編集 しません。 タイプミス(またはそれ以上)が blead または maint-* へのコミットに 忍び込んだ場合は、別のコミットで修正します。 これらのブランチで許可されている更新のタイプは "fast-forward" だけで、 すべての履歴が保存されます。

Annotated tags in the canonical perl.git repository will never be deleted or modified. Think long and hard about whether you want to push a local tag to perl.git before doing so. (Pushing unannotated tags is not allowed.)

標準的な perl.git リポジトリ内の注釈付きタグは、削除や 変更されることはありません。 ローカルタグを perl.git にプッシュする前に、じっくり考えてみてください (注釈なしタグのプッシュは許可されていません)。

git リポジトリへの書き込みアクセス

Once you have write access, you will need to modify the URL for the origin remote to enable pushing. Edit .git/config with the git-config(1) command:

一旦書き込み権限を得たら、 プッシュを有効にするために origin remote のための URL を 変更する必要があります。 git-config(1) コマンドで .git/config を次のように編集します:

  % git config remote.origin.url ssh://perl5.git.perl.org/perl.git

You can also set up your user name and e-mail address. Most people do this once globally in their ~/.gitconfig by doing something like:

ユーザー名と電子メールアドレスを設定することもできます。 ほとんどの人は、以下のようにすることで ~/.gitconfig でグローバルに 一度これを行います:

  % git config --global user.name "Ævar Arnfjörð Bjarmason"
  % git config --global user.email avarab@gmail.com

However if you'd like to override that just for perl then execute then execute something like the following in perl:

しかし、perl だけに対してこれを変更したい場合は、 perl で次のようなものを実行します:

  % git config user.email avar@cpan.org

It is also possible to keep origin as a git remote, and add a new remote for ssh access:

origin を git remote として維持し、ssh アクセス用の新しい remote を 追加することも可能です:

  % git remote add camel perl5.git.perl.org:/perl.git

This allows you to update your local repository by pulling from origin, which is faster and doesn't require you to authenticate, and to push your changes back with the camel remote:

これにより、origin からプルしてローカルリポジトリを更新できます; これはより高速で、認証を必要としません; また、camel リモートで変更をプッシュバックすることもできます。

  % git fetch camel
  % git push camel

The fetch command just updates the camel refs, as the objects themselves should have been fetched when pulling from origin.

fetch コマンドは単に camel refs を更新するだけです; なぜなら、オブジェクト自体は origin からプルするときに フェッチされるべきだからです。

パッチを受け入れる

If you have received a patch file generated using the above section, you should try out the patch.

前述の節でを使って生成されたパッチファイルを受け取った場合は、 パッチを試してみてください。

First we need to create a temporary new branch for these changes and switch into it:

まず、これらの変更のための一時的な新しいブランチを作成し、そのブランチに 切り替える必要があります:

  % git checkout -b experimental

Patches that were formatted by git format-patch are applied with git am:

git format-patch でフォーマットされたパッチは、git am で適用されます:

  % git am 0001-Rename-Leon-Brocard-to-Orange-Brocard.patch
  Applying Rename Leon Brocard to Orange Brocard

If just a raw diff is provided, it is also possible use this two-step process:

生の diff だけが提供されている場合は、次の 2 段階のプロセスを 使用することもできます:

  % git apply bugfix.diff
  % git commit -a -m "Some fixing" --author="That Guy <that.guy@internets.com>"

Now we can inspect the change:

ここで変更を検査できます:

  % git show HEAD
  commit b1b3dab48344cff6de4087efca3dbd63548ab5e2
  Author: Leon Brocard <acme@astray.com>
  Date:   Fri Dec 19 17:02:59 2008 +0000

    Rename Leon Brocard to Orange Brocard

  diff --git a/AUTHORS b/AUTHORS
  index 293dd70..722c93e 100644
  --- a/AUTHORS
  +++ b/AUTHORS
  @@ -541,7 +541,7 @@ Lars Hecking                        <lhecking@nmrc.ucc.ie>
   Laszlo Molnar                  <laszlo.molnar@eth.ericsson.se>
   Leif Huhn                      <leif@hale.dkstat.com>
   Len Johnson                    <lenjay@ibm.net>
  -Leon Brocard                   <acme@astray.com>
  +Orange Brocard                 <acme@astray.com>
   Les Peters                     <lpeters@aol.net>
   Lesley Binks                   <lesley.binks@gmail.com>
   Lincoln D. Stein               <lstein@cshl.org>

If you are a committer to Perl and you think the patch is good, you can then merge it into blead then push it out to the main repository:

もしあなたが Perl のコミッタで、パッチが良いものだと思うなら、 それを blead にマージしてメインのリポジトリにプッシュすることができます:

  % git checkout blead
  % git merge experimental
  % git push

If you want to delete your temporary branch, you may do so with:

一時的なブランチを削除したいなら、以下のようにできます:

  % git checkout blead
  % git branch -d experimental
  error: The branch 'experimental' is not an ancestor of your current HEAD.
  If you are sure you want to delete it, run 'git branch -D experimental'.
  % git branch -D experimental
  Deleted branch experimental.

blead にコミットする

The 'blead' branch will become the next production release of Perl.

'blead' ブランチは、Perl の次の正式版リリースになります。

Before pushing any local change to blead, it's incredibly important that you do a few things, lest other committers come after you with pitchforks and torches:

何らかの ローカルな変更をプッシュする前に、 あなたの後から来る他のコミッタが熊手と松明を持ってこないように、 いくつかのことをするのが極めて重要です:

  • Make sure you have a good commit message. See "Commit message" in perlhack for details.

    よいコミットメッセージを書くようにしてください。 詳しくは "Commit message" in perlhack を参照してください。

  • Run the test suite. You might not think that one typo fix would break a test file. You'd be wrong. Here's an example of where not running the suite caused problems. A patch was submitted that added a couple of tests to an existing .t. It couldn't possibly affect anything else, so no need to test beyond the single affected .t, right? But, the submitter's email address had changed since the last of their submissions, and this caused other tests to fail. Running the test target given in the next item would have caught this problem.

    テストスイートを実行します。 一つのタイプミス修正がテストファイルを壊すとは思わないかもしれません。 それは間違いです。 スイートを実行しないと問題が発生する例を次に示します。 既存の .t にいくつかのテストを追加するパッチが提出されました。 他の何にも影響する可能性はないので、 影響を受けた一つ以上をテストする必要はありません。 そうですね? しかし、送信者のメールアドレスが前回の送信時から変更されていて、 このための他のテストが失敗するようになりました。 次の項目のテストターゲットを実行すると、この問題を捕まえられます。

  • If you don't run the full test suite, at least make test_porting. This will run basic sanity checks. To see which sanity checks, have a look in t/porting.

    完全なテストスイートを実行しない場合でも、 最低 make test_porting は実行してください。 これは基本的な正気チェックを実行します。 どの正気チェックかを見るには、t/porting を見てください。

  • If you make any changes that affect miniperl or core routines that have different code paths for miniperl, be sure to run make minitest. This will catch problems that even the full test suite will not catch because it runs a subset of tests under miniperl rather than perl.

    miniperl や miniperl のための異なるコードパスを持つコアルーチンに 影響する変更を行う場合、make minitest をするようにしてください。 これは、perl ではなく miniperl でテストの一部を行うために完全な テストスイートでは捕捉できない問題も捕捉します。

メンテナンスバージョンにコミットする

Maintenance versions should only be altered to add critical bug fixes, see perlpolicy.

メンテナンスバージョンは、重要なバグ修正を追加する場合にのみ変更してください; perlpolicy を参照してください。

To commit to a maintenance version of perl, you need to create a local tracking branch:

perl のメンテナンスバージョンにコミットするには、 ローカル追跡ブランチを作成する必要があります。

  % git checkout --track -b maint-5.005 origin/maint-5.005

This creates a local branch named maint-5.005, which tracks the remote branch origin/maint-5.005. Then you can pull, commit, merge and push as before.

これにより、リモートブランチ origin/maint-5.005 を追跡する maint-5.005 という名前のローカルブランチが作成されます。 次に、以前と同じようにプル、コミット、マージ、プッシュを行うことができます。

You can also cherry-pick commits from blead and another branch, by using the git cherry-pick command. It is recommended to use the -x option to git cherry-pick in order to record the SHA1 of the original commit in the new commit message.

git cherry-pick コマンドを使用して、blead と別のブランチから コミットをチェリーピックすることもできます。 元のコミットの SHA1 を新しいコミットメッセージに記録するために、 git cherry-pick-x オプションを使うことを勧めます。

Before pushing any change to a maint version, make sure you've satisfied the steps in "Committing to blead" above.

maint 版に何かをプッシュする前に、前述の "Committing to blead" のステップを満たしていることを確認してください。

接ぎ木

The perl history contains one mistake which was not caught in the conversion: a merge was recorded in the history between blead and maint-5.10 where no merge actually occurred. Due to the nature of git, this is now impossible to fix in the public repository. You can remove this mis-merge locally by adding the following line to your .git/info/grafts file:

Perl履歴には、変換で検出されなかった誤りが一つ含まれています: blead と maint-5.10 の間の履歴にマージが記録されましたが、 実際にはマージは発生しませんでした。 git の性質上、パブリックリポジトリで修正することは現在不可能です。 .git/info/graft ファイルに次の行を追加することで、 この誤ったマージをローカルで削除できます。

  296f12bbbbaa06de9be9d09d3dcf8f4528898a49 434946e0cb7a32589ed92d18008aaa1d88515930

It is particularly important to have this graft line if any bisecting is done in the area of the "merge" in question.

問題の「マージ」領域で bisect が行われる場合、この graft 行を 指定することが特に重要です。

GitHub 経由のブランチをマージする

While we don't encourage the submission of patches via GitHub, that will still happen. Here is a guide to merging patches from a GitHub repository.

私たちはパッチを GitHub 経由で投稿することを勧めていませんが、 実際発生します。 これは GitHub リポジトリからのパッチをマージするためのガイドです。

  % git remote add avar git://github.com/avar/perl.git
  % git fetch avar

Now you can see the differences between the branch and blead:

これで、そのブランチと blead の差分を見られるようになりました:

  % git diff avar/orange

And you can see the commits:

そしてコミットを表示できます:

  % git log avar/orange

If you approve of a specific commit, you can cherry pick it:

特定のコミットを承認する場合は、次のようにして選択できます:

  % git cherry-pick 0c24b290ae02b2ab3304f51d5e11e85eb3659eae

Or you could just merge the whole branch if you like it all:

または、必要に応じてブランチ全体をマージすることもできます:

  % git merge avar/orange

And then push back to the repository:

そして、リポジトリにプッシュバックします:

  % git push

camel と dromedary に関する注意

The committers have SSH access to the two servers that serve perl5.git.perl.org. One is perl5.git.perl.org itself (camel), which is the 'master' repository. The second one is users.perl5.git.perl.org (dromedary), which can be used for general testing and development. Dromedary syncs the git tree from camel every few minutes, you should not push there. Both machines also have a full CPAN mirror in /srv/CPAN, please use this. To share files with the general public, dromedary serves your ~/public_html/ as http://users.perl5.git.perl.org/~yourlogin/

コミッタは、perl5.git.perl.org にサービスを提供する二つの サーバにアクセスできます。 perl5.git.perl.org 自身 (camel) で、 これが「マスター」リポジトリです。 二つ目は users.perl5.git.perl.org (dromedary) で、 一般的なテストと開発に使用できます。 dromedary は数分ごとに camel から git ツリーを同期するので、そこに プッシュしてはいけません。 両方のマシンには /srv/CPAN に完全な CPAN ミラーもあるので、 これを使ってください。 dromedary はファイルを一般公開するために、 ~/public_html/ を http://users.perl5.git.perl.org/~yourlogin/ として 提供しています。

These hosts have fairly strict firewalls to the outside. Outgoing, only rsync, ssh and git are allowed. For http and ftp, you can use http://webproxy:3128 as proxy. Incoming, the firewall tries to detect attacks and blocks IP addresses with suspicious activity. This sometimes (but very rarely) has false positives and you might get blocked. The quickest way to get unblocked is to notify the admins.

これらのホストは、外部に対してかなり厳格なファイアウォールを持っています。 送信は rsync、ssh、git だけが許可されています。 http と ftp に対しては、プロキシとして http://webproxy:3128 を使用できます。 受信は、ファイアウォールは攻撃を検出し、疑わしいアクティビティを持つ IP アドレスをブロックしようとします。 これは時に(非常にまれに)誤検出があり、ブロックされる可能性があります。 ブロックを解除する最も簡単な方法は、管理者に通知することです。

These two boxes are owned, hosted, and operated by booking.com. You can reach the sysadmins in #p5p on irc.perl.org or via mail to perl5-porters@perl.org.

これら二つのボックスは、booking.com によって所有され、ホストされ、 運営されています。 システム管理者には、irc.perl.org の #p5p か、 perl5-porters@perl.org へのメールで連絡できます。