← Documents Documentation/maintainer/pull-requests.rst GitHub 원문 ↗

Linux 6.18.37 · Maintainer

Creating Pull Requests

별도 branch와 signed tag를 준비하고 `git request-pull` 출력을 inline email로 제출하는 maintainer workflow입니다.

Source pathDocumentation/maintainer/pull-requests.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

요약·해설

pull-requests.rst:1-176

Pull request에는 수신 tree를 base로 한 별도 branch, 의미 있는 signed tag, 내용·merge 이유·test 결과를 담은 영구 기록용 message가 필요합니다.

Tag를 public remote에 push한 뒤 base·repository URL·tag를 `git request-pull`에 넘겨 diffstat과 shortlog를 생성합니다.

완성된 요청은 일반 patch처럼 maintainer와 필요한 mailing list에 inline email로 제출합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

원문 전체 펼치기
1 Creating Pull Requests
2 ======================
3
4 This chapter describes how maintainers can create and submit pull requests
5 to other maintainers. This is useful for transferring changes from one
6 maintainers tree to another maintainers tree.
7
8 This document was written by Tobin C. Harding (who at that time, was not an
9 experienced maintainer) primarily from comments made by Greg Kroah-Hartman
10 and Linus Torvalds on LKML. Suggestions and fixes by Jonathan Corbet and
11 Mauro Carvalho Chehab. Misrepresentation was unintentional but inevitable,
12 please direct abuse to Tobin C. Harding <[email protected]>.
13
14 Original email thread::
15
16 https://lore.kernel.org/r/[email protected]
17
18
19 Create Branch
20 -------------
21
22 To start with you will need to have all the changes you wish to include in
23 the pull request on a separate branch. Typically you will base this branch
24 off of a branch in the developers tree whom you intend to send the pull
25 request to.
26
27 In order to create the pull request you must first tag the branch that you
28 have just created. It is recommended that you choose a meaningful tag name,
29 in a way that you and others can understand, even after some time. A good
30 practice is to include in the name an indicator of the subsystem of origin
31 and the target kernel version.
32
33 Greg offers the following. A pull request with miscellaneous stuff for
34 drivers/char, to be applied at the Kernel version 4.15-rc1 could be named
35 as ``char-misc-4.15-rc1``. If such tag would be produced from a branch
36 named ``char-misc-next``, you would be using the following command::
37
38 git tag -s char-misc-4.15-rc1 char-misc-next
39
40 that will create a signed tag called ``char-misc-4.15-rc1`` based on the
41 last commit in the ``char-misc-next`` branch, and sign it with your gpg key
42 (see Documentation/maintainer/configure-git.rst).
43
44 Linus will only accept pull requests based on a signed tag. Other
45 maintainers may differ.
46
47 When you run the above command ``git`` will drop you into an editor and ask
48 you to describe the tag. In this case, you are describing a pull request,
49 so outline what is contained here, why it should be merged, and what, if
50 any, testing has been done. All of this information will end up in the tag
51 itself, and then in the merge commit that the maintainer makes if/when they
52 merge the pull request. So write it up well, as it will be in the kernel
53 tree forever.
54
55 As said by Linus::
56
57 Anyway, at least to me, the important part is the *message*. I want
58 to understand what I'm pulling, and why I should pull it. I also
59 want to use that message as the message for the merge, so it should
60 not just make sense to me, but make sense as a historical record
61 too.
62
63 Note that if there is something odd about the pull request, that
64 should very much be in the explanation. If you're touching files
65 that you don't maintain, explain _why_. I will see it in the
66 diffstat anyway, and if you didn't mention it, I'll just be extra
67 suspicious. And when you send me new stuff after the merge window
68 (or even bug-fixes, but ones that look scary), explain not just
69 what they do and why they do it, but explain the _timing_. What
70 happened that this didn't go through the merge window..
71
72 I will take both what you write in the email pull request _and_ in
73 the signed tag, so depending on your workflow, you can either
74 describe your work in the signed tag (which will also automatically
75 make it into the pull request email), or you can make the signed
76 tag just a placeholder with nothing interesting in it, and describe
77 the work later when you actually send me the pull request.
78
79 And yes, I will edit the message. Partly because I tend to do just
80 trivial formatting (the whole indentation and quoting etc), but
81 partly because part of the message may make sense for me at pull
82 time (describing the conflicts and your personal issues for sending
83 it right now), but may not make sense in the context of a merge
84 commit message, so I will try to make it all make sense. I will
85 also fix any speeling mistaeks and bad grammar I notice,
86 particularly for non-native speakers (but also for native ones
87 ;^). But I may miss some, or even add some.
88
89 Linus
90
91 Greg gives, as an example pull request::
92
93 Char/Misc patches for 4.15-rc1
94
95 Here is the big char/misc patch set for the 4.15-rc1 merge window.
96 Contained in here is the normal set of new functions added to all
97 of these crazy drivers, as well as the following brand new
98 subsystems:
99 - time_travel_controller: Finally a set of drivers for the
100 latest time travel bus architecture that provides i/o to
101 the CPU before it asked for it, allowing uninterrupted
102 processing
103 - relativity_shifters: due to the affect that the
104 time_travel_controllers have on the overall system, there
105 was a need for a new set of relativity shifter drivers to
106 accommodate the newly formed black holes that would
107 threaten to suck CPUs into them. This subsystem handles
108 this in a way to successfully neutralize the problems.
109 There is a Kconfig option to force these to be enabled
110 when needed, so problems should not occur.
111
112 All of these patches have been successfully tested in the latest
113 linux-next releases, and the original problems that it found have
114 all been resolved (apologies to anyone living near Canberra for the
115 lack of the Kconfig options in the earlier versions of the
116 linux-next tree creations.)
117
118 Signed-off-by: Your-name-here <your_email@domain>
119
120
121 The tag message format is just like a git commit id. One line at the top
122 for a "summary subject" and be sure to sign-off at the bottom.
123
124 Now that you have a local signed tag, you need to push it up to where it
125 can be retrieved::
126
127 git push origin char-misc-4.15-rc1
128
129
130 Create Pull Request
131 -------------------
132
133 The last thing to do is create the pull request message. ``git`` handily
134 will do this for you with the ``git request-pull`` command, but it needs a
135 bit of help determining what you want to pull, and on what to base the pull
136 against (to show the correct changes to be pulled and the diffstat). The
137 following command(s) will generate a pull request::
138
139 git request-pull master git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ char-misc-4.15-rc1
140
141 Quoting Greg::
142
143 This is asking git to compare the difference from the
144 'char-misc-4.15-rc1' tag location, to the head of the 'master'
145 branch (which in my case points to the last location in Linus's
146 tree that I diverged from, usually a -rc release) and to use the
147 git:// protocol to pull from. If you wish to use https://, that
148 can be used here instead as well (but note that some people behind
149 firewalls will have problems with https git pulls).
150
151 If the char-misc-4.15-rc1 tag is not present in the repo that I am
152 asking to be pulled from, git will complain saying it is not there,
153 a handy way to remember to actually push it to a public location.
154
155 The output of 'git request-pull' will contain the location of the
156 git tree and specific tag to pull from, and the full text
157 description of that tag (which is why you need to provide good
158 information in that tag). It will also create a diffstat of the
159 pull request, and a shortlog of the individual commits that the
160 pull request will provide.
161
162 Linus responded that he tends to prefer the ``git://`` protocol. Other
163 maintainers may have different preferences. Also, note that if you are
164 creating pull requests without a signed tag then ``https://`` may be a
165 better choice. Please see the original thread for the full discussion.
166
167
168 Submit Pull Request
169 -------------------
170
171 A pull request is submitted in the same way as an ordinary patch. Send as
172 inline email to the maintainer and CC LKML and any sub-system specific
173 lists if required. Pull requests to Linus typically have a subject line
174 something like::
175
176 [GIT PULL] <subsystem> changes for v4.15-rc1
177

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

Pull request 작성 개요

1-18

이 장은 maintainer가 자신의 tree에서 다른 maintainer의 tree로 변경을 전달하기 위한 pull request를 만들고 제출하는 방법을 설명합니다.

문서는 당시 경험이 많지 않았던 maintainer Tobin C. Harding이 Greg Kroah-Hartman과 Linus Torvalds의 LKML 의견을 중심으로 작성했고, Jonathan Corbet과 Mauro Carvalho Chehab가 제안과 수정을 제공했습니다.

원본 email thread는 `https://lore.kernel.org/r/[email protected]`에서 확인할 수 있습니다.

Pull request 전체 단계
단계산출물
Branch 준비전달할 변경만 담은 별도 branch
Signed tag 생성의미 있는 이름과 영구 기록용 설명
Tag 공개수신자가 가져갈 수 있는 remote tag
`git request-pull`위치·tag message·diffstat·shortlog
Email 제출Maintainer와 필요한 list에 inline request

변경 branch 준비부터 inline email 제출까지의 흐름입니다.

Creating Pull Requests
======================

This chapter describes how maintainers can create and submit pull requests
to other maintainers. This is useful for transferring changes from one
maintainers tree to another maintainers tree.

This document was written by Tobin C. Harding (who at that time, was not an
experienced maintainer) primarily from comments made by Greg Kroah-Hartman
and Linus Torvalds on LKML. Suggestions and fixes by Jonathan Corbet and
Mauro Carvalho Chehab.  Misrepresentation was unintentional but inevitable,
please direct abuse to Tobin C. Harding <[email protected]>.

Original email thread::

        https://lore.kernel.org/r/[email protected]

Branch와 signed tag 생성

19-54

Pull request에 포함할 모든 변경은 별도 branch에 모아야 합니다. 보통 요청을 받을 개발자의 tree에 있는 branch를 base로 삼습니다.

Pull request를 만들기 전에 이 branch에 tag를 붙입니다. 시간이 지난 뒤에도 의미를 알 수 있도록 subsystem 출처와 target kernel version을 포함한 이름을 권장합니다.

예를 들어 `drivers/char`의 miscellaneous 변경을 kernel `4.15-rc1`에 적용하려면 tag를 `char-misc-4.15-rc1`이라고 할 수 있습니다. `char-misc-next` branch tip을 대상으로 `git tag -s char-misc-4.15-rc1 char-misc-next`를 실행합니다.

이 명령은 `char-misc-next`의 마지막 commit을 가리키는 signed tag를 만들고 GPG key로 서명합니다. Key 설정은 `Documentation/maintainer/configure-git.rst`를 참고합니다. Linus는 signed tag 기반 pull request만 받지만 다른 maintainer의 정책은 다를 수 있습니다.

Git이 editor를 열면 tag 설명에 무엇이 들어 있는지, 왜 merge해야 하는지, 어떤 test를 수행했는지 적습니다. 이 정보는 tag 자체와 수신 maintainer가 만드는 merge commit에 들어가 kernel tree의 영구 기록이 되므로 충실히 작성해야 합니다.

Branch와 tag 준비
수신 maintainer tree의 적절한 branch 선택그 branch를 base로 전용 work branch 구성Subsystem·target version을 담은 tag 이름 결정`git tag -s <tag> <branch>` 실행내용·merge 이유·test 결과를 tag message에 기록

수신 tree의 base와 전달 tip을 고정한 뒤 서명합니다.

Tag 이름 예
요소예시
Subsystem·queue`char-misc`
Target kernel`4.15-rc1`
완성 tag`char-misc-4.15-rc1`
대상 branch`char-misc-next`

이름만 보고도 출처와 목표 release를 알 수 있게 합니다.

Create Branch
-------------

To start with you will need to have all the changes you wish to include in
the pull request on a separate branch. Typically you will base this branch
off of a branch in the developers tree whom you intend to send the pull
request to.

In order to create the pull request you must first tag the branch that you
have just created. It is recommended that you choose a meaningful tag name,
in a way that you and others can understand, even after some time.  A good
practice is to include in the name an indicator of the subsystem of origin
and the target kernel version.

Greg offers the following. A pull request with miscellaneous stuff for
drivers/char, to be applied at the Kernel version 4.15-rc1 could be named
as ``char-misc-4.15-rc1``. If such tag would be produced from a branch
named ``char-misc-next``, you would be using the following command::

        git tag -s char-misc-4.15-rc1 char-misc-next

that will create a signed tag called ``char-misc-4.15-rc1`` based on the
last commit in the ``char-misc-next`` branch, and sign it with your gpg key
(see Documentation/maintainer/configure-git.rst).

Linus will only accept pull requests based on a signed tag. Other
maintainers may differ.

When you run the above command ``git`` will drop you into an editor and ask
you to describe the tag.  In this case, you are describing a pull request,
so outline what is contained here, why it should be merged, and what, if
any, testing has been done.  All of this information will end up in the tag
itself, and then in the merge commit that the maintainer makes if/when they
merge the pull request. So write it up well, as it will be in the kernel
tree forever.

좋은 tag message

55-120

Linus가 강조하는 핵심은 message입니다. 수신자는 무엇을 pull하는지와 왜 pull해야 하는지 이해해야 하며, message는 merge commit의 역사적 기록으로도 자연스러워야 합니다.

유지보수하지 않는 file을 건드리는 것처럼 이상한 점이 있으면 이유를 설명해야 합니다. Diffstat에서 결국 보이므로 설명하지 않으면 오히려 의심을 키웁니다.

Merge window 뒤에 새 기능을 보내거나 겉보기에 위험한 bug fix를 보내는 경우에는 무엇을 왜 하는지뿐 아니라 timing도 설명해야 합니다. 왜 merge window를 통과하지 못했는지 기록합니다.

수신 maintainer는 email pull request와 signed tag의 내용을 모두 사용합니다. Workflow에 따라 signed tag에 상세 설명을 넣어 email에 자동 포함시키거나, tag는 간단히 두고 실제 요청 email에서 설명할 수 있습니다.

Merge하는 maintainer는 formatting을 정리하고, pull 시점에만 의미가 있는 conflict나 개인 사정을 merge commit 문맥에 맞게 편집하며, spelling과 grammar를 고칠 수 있습니다.

Greg의 예시는 `Char/Misc patches for 4.15-rc1`이라는 한 줄 summary 뒤에 patchset의 범위, 새 subsystem, linux-next test 결과와 해결된 문제를 설명하고 마지막에 `Signed-off-by`를 둡니다.

Tag message 필수 정보
항목설명
Summary subject맨 위 한 줄 요약
What포함된 subsystem·기능·fix
Why지금 merge해야 하는 이유
Odd scope담당 밖 file을 건드린 이유
TimingMerge window 이후 제출 사유
Testinglinux-next·CI·실기 test 결과
Sign-offMessage 마지막 `Signed-off-by`

수신 판단과 장기 history 양쪽에 필요한 내용을 담습니다.

As said by Linus::

        Anyway, at least to me, the important part is the *message*. I want
        to understand what I'm pulling, and why I should pull it. I also
        want to use that message as the message for the merge, so it should
        not just make sense to me, but make sense as a historical record
        too.

        Note that if there is something odd about the pull request, that
        should very much be in the explanation. If you're touching files
        that you don't maintain, explain _why_. I will see it in the
        diffstat anyway, and if you didn't mention it, I'll just be extra
        suspicious.  And when you send me new stuff after the merge window
        (or even bug-fixes, but ones that look scary), explain not just
        what they do and why they do it, but explain the _timing_. What
        happened that this didn't go through the merge window..

        I will take both what you write in the email pull request _and_ in
        the signed tag, so depending on your workflow, you can either
        describe your work in the signed tag (which will also automatically
        make it into the pull request email), or you can make the signed
        tag just a placeholder with nothing interesting in it, and describe
        the work later when you actually send me the pull request.

        And yes, I will edit the message. Partly because I tend to do just
        trivial formatting (the whole indentation and quoting etc), but
        partly because part of the message may make sense for me at pull
        time (describing the conflicts and your personal issues for sending
        it right now), but may not make sense in the context of a merge
        commit message, so I will try to make it all make sense. I will
        also fix any speeling mistaeks and bad grammar I notice,
        particularly for non-native speakers (but also for native ones
        ;^). But I may miss some, or even add some.

                        Linus

Greg gives, as an example pull request::

        Char/Misc patches for 4.15-rc1

        Here is the big char/misc patch set for the 4.15-rc1 merge window.
        Contained in here is the normal set of new functions added to all
        of these crazy drivers, as well as the following brand new
        subsystems:
                - time_travel_controller: Finally a set of drivers for the
                  latest time travel bus architecture that provides i/o to
                  the CPU before it asked for it, allowing uninterrupted
                  processing
                - relativity_shifters: due to the affect that the
                  time_travel_controllers have on the overall system, there
                  was a need for a new set of relativity shifter drivers to
                  accommodate the newly formed black holes that would
                  threaten to suck CPUs into them.  This subsystem handles
                  this in a way to successfully neutralize the problems.
                  There is a Kconfig option to force these to be enabled
                  when needed, so problems should not occur.

        All of these patches have been successfully tested in the latest
        linux-next releases, and the original problems that it found have
        all been resolved (apologies to anyone living near Canberra for the
        lack of the Kconfig options in the earlier versions of the
        linux-next tree creations.)

        Signed-off-by: Your-name-here <your_email@domain>

Tag 형식과 remote push

121-129

Tag message 형식은 Git commit message와 같습니다. 맨 위에 한 줄 summary subject를 쓰고 아래 본문을 작성한 뒤 마지막에 sign-off를 넣습니다.

Local signed tag가 준비되면 수신자가 가져갈 수 있는 remote에 push해야 합니다. 예시는 `git push origin char-misc-4.15-rc1`입니다.

Signed tag 공개
한 줄 subject와 본문·sign-off를 가진 tag 확인`git push origin char-misc-4.15-rc1`Remote repository에 동일 tag가 존재하는지 확인

Local 서명 결과를 pull 가능한 remote reference로 만듭니다.

The tag message format is just like a git commit id.  One line at the top
for a "summary subject" and be sure to sign-off at the bottom.

Now that you have a local signed tag, you need to push it up to where it
can be retrieved::

        git push origin char-misc-4.15-rc1

`git request-pull`로 요청 생성

130-167

마지막 준비는 pull request message 생성입니다. `git request-pull`은 무엇을 pull할지와 어떤 base를 기준으로 비교할지 알아야 올바른 변경 목록과 diffstat을 만들 수 있습니다.

예시 명령은 `git request-pull master git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ char-misc-4.15-rc1`입니다. `master`는 maintainer가 Linus tree에서 갈라진 마지막 지점, 보통 `-rc` release를 가리키고, 마지막 인자는 pull할 signed tag입니다.

Tag가 요청한 public repository에 없으면 Git이 오류를 내므로 tag push를 빠뜨렸다는 사실도 확인할 수 있습니다.

출력에는 Git tree 위치와 특정 tag, tag의 전체 설명, pull request diffstat, 포함되는 individual commit shortlog가 들어갑니다. 좋은 tag 설명이 필요한 이유가 여기서도 드러납니다.

Linus는 `git://` protocol을 선호한다고 답했지만 maintainer마다 preference가 다를 수 있습니다. Signed tag 없이 pull request를 만든다면 `https://`가 더 나을 수 있으며, firewall 환경의 protocol 제약도 고려해야 합니다.

`git request-pull` 입력과 출력
Base branch 또는 commit: 예시 `master`Public repository URL: `git://.../char-misc.git/`Pull 대상 tag: `char-misc-4.15-rc1`Git이 remote tag 존재 여부 확인Tree URL·tag 설명·diffstat·shortlog 출력

Base, public repository, signed tag 세 입력으로 요청 본문을 생성합니다.

Protocol 선택
Protocol고려사항
`git://`Linus의 선호 예시, 수신자 정책 확인
`https://`Unsigned tag 요청에서 더 적합할 수 있음, 일부 firewall 환경 고려

수신 maintainer 정책과 서명 방식, network 환경을 확인합니다.

Create Pull Request
-------------------

The last thing to do is create the pull request message.  ``git`` handily
will do this for you with the ``git request-pull`` command, but it needs a
bit of help determining what you want to pull, and on what to base the pull
against (to show the correct changes to be pulled and the diffstat). The
following command(s) will generate a pull request::

        git request-pull master git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ char-misc-4.15-rc1

Quoting Greg::

        This is asking git to compare the difference from the
        'char-misc-4.15-rc1' tag location, to the head of the 'master'
        branch (which in my case points to the last location in Linus's
        tree that I diverged from, usually a -rc release) and to use the
        git:// protocol to pull from.  If you wish to use https://, that
        can be used here instead as well (but note that some people behind
        firewalls will have problems with https git pulls).

        If the char-misc-4.15-rc1 tag is not present in the repo that I am
        asking to be pulled from, git will complain saying it is not there,
        a handy way to remember to actually push it to a public location.

        The output of 'git request-pull' will contain the location of the
        git tree and specific tag to pull from, and the full text
        description of that tag (which is why you need to provide good
        information in that tag).  It will also create a diffstat of the
        pull request, and a shortlog of the individual commits that the
        pull request will provide.

Linus responded that he tends to prefer the ``git://`` protocol. Other
maintainers may have different preferences. Also, note that if you are
creating pull requests without a signed tag then ``https://`` may be a
better choice. Please see the original thread for the full discussion.

Pull request 제출

168-176

Pull request는 일반 patch와 같은 방식으로 제출합니다. Maintainer에게 inline email로 보내고, 필요하면 LKML과 subsystem별 mailing list를 CC합니다.

Linus에게 보내는 요청의 subject는 보통 `[GIT PULL] <subsystem> changes for v4.15-rc1` 같은 형식입니다. 수신자가 list에서 요청 종류, subsystem, target release를 바로 식별할 수 있게 합니다.

Email 제출 대상
생성한 request-pull 출력 검토Maintainer에게 inline email 작성필요한 LKML·subsystem list CCSubject에 `[GIT PULL]`, subsystem, target release 표시

Pull request도 공개 patch workflow 안에서 전달합니다.

Submit Pull Request
-------------------

A pull request is submitted in the same way as an ordinary patch. Send as
inline email to the maintainer and CC LKML and any sub-system specific
lists if required. Pull requests to Linus typically have a subject line
something like::

        [GIT PULL] <subsystem> changes for v4.15-rc1