There is currently no documentation on how to create a pull request for Linus. Anyway, this actually came up at the kernel summit / maintainer meeting a few weeks ago, in that "how do I make a good pull request to Linus" is something we need to document. Here's what I do, and it seems to work well, so maybe we should turn it into the start of the documentation for how to do it. Create document from email thread on LKML (referenced in document). Signed-off-by: Tobin C. Harding <me@xxxxxxxx> --- Is it rude to send this during the merge window? Can resend after it closes if it makes life easier. thanks, Tobin. Documentation/process/submitting-pull-requests.rst | 171 +++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 Documentation/process/submitting-pull-requests.rst diff --git a/Documentation/process/submitting-pull-requests.rst b/Documentation/process/submitting-pull-requests.rst new file mode 100644 index 000000000000..9528aead4809 --- /dev/null +++ b/Documentation/process/submitting-pull-requests.rst @@ -0,0 +1,171 @@ +Submitting Pull Requests to Linus: a guide for maintainers +========================================================== + +This document is aimed at kernel maintainers. It describes a method for creating +a pull request to be sent to Linus. + +Configure Git +------------- + +Since you _usually_ would use the same key for the same project, just set it +once with + + git config user.signingkey "keyname" + +and if you use the same key for everything, just add "--global". + +Or just edit your .git/config or ~/.gitconfig file by hand, it's designed to be +human-readable and writable, and not some garbage like XML: + + [torvalds@i7 ~]$ head -4 .gitconfig + [user] + name = Linus Torvalds + email = torvalds@xxxxxxxxxxxxxxxxxxxx + signingkey = torvalds@xxxxxxxxxxxxxxxxxxxx + +You may need to tell git to use gpg2 + + [gpg] + program = /path/to/gpg2 + +You may also like to tell gpg which tty to use (add to shell rc file) + + export GPG_TTY=$(tty) + + +Branch, Tag, Push +----------------- + +Next, put your changes on a branch, hopefully one named in a semi-useful way (I +use 'char-misc-next' for my char/misc driver patches to be merged into +linux-next). That is the branch you wish to tag and have Linus pull from. + +Name the tag with something useful that you can understand if you run across it +in a few weeks, and something that will be "unique". Continuing the example of +the char-misc tree, for the patches to be sent to Linus for the 4.15-rc1 merge +window, I would name the tag 'char-misc-4.15-rc1': + + 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 (configured +above). + +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 +happened to it. All of this information will end up in the tag itself, and then +in the merge commit that Linus makes, so write it up well, as it will be in the +kernel tree for forever. + + 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 + +An example pull request of mine might look like: + 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> + + +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 by Linus: + + git push origin char-misc-4.15-rc1 + +pushes the char-misc-4.15-rc1 tag to where the 'origin' repo is located. + + +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 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: + + $TREE=git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/ + git request-pull master $TREE char-misc-4.15-rc1 + +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). + +Note: please use the git protocol (for justification from Linus see referenced +email thread). + +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. + + +References +---------- + +The thread that this document is based on: + + https://lkml.org/lkml/2017/11/14/184 -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html