[LINUX] Creating Pull Requests

Originally, it is a part of the Linux Kernel source code, so it will be treated as GPLv2 (recognition that it should be).

https://www.kernel.org/doc/html/latest/index.html

Licensing documentation

The following describes the license of the Linux kernel source code (GPLv2), how to properly mark the license of individual files in the source tree, as well as links to the full license text.

https://www.kernel.org/doc/html/latest/process/license-rules.html#kernel-licensing

https://www.kernel.org/doc/html/latest/maintainer/pull-requests.html

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 chapter describes how maintainers make and send pull requests to other maintainers. This helps transfer fixes from one maintainer's tree to another maintainer's 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 me@tobin.cc.

This text was written by Tobin C. Harding from a comment made by Greg Kroah-Hartman and Linus Torvalds at LKML (at this time he was not yet a seasoned maintainer). Suggestions and corrections made by Jonathan Corbet and Mauro Carvalho Chehab. Misstatements are unintentional, but unavoidable. If you notice any mistakes, please contact Tobin C. Harding [email protected]

Original email thread:

http://lkml.kernel.org/r/[email protected]

.

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.

First, you need to include all the fixes you're trying to include in your pull request in different branches. In general, you are based on the branch of the development tree from which you are sending pull requests.

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.

In order to create a pull request, you need to first tag the branch you just created. It is recommended that the tag name be something that others can understand even after a while. A good practice is to include the origin subsystem and the target kernel version in the name.

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:

Greg applies for: A pull request for kernel version 4.15-rc1 for other elements (miscellaneous), including drivers / char, is named char-misc-4.15-rc1. If such a tag is provided by a branch named char-misc-next, run the command below.

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).

A signed tag called char-misc-4.15-rc1 is created based on the recommit of the char-misc-next branch. It is signed by your gpg key (see Documentation / maintainer / configure-git.rst)

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

Linus only allows pull requests based on signed tags. Other maintainers may be different.

.

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 for forever.

When you run the command above, git will open an editor and ask you to write the tag details. In this case, you write a pull request. Include an outline of "what is included here", "why it needs to be merged", and "how the tests were done, if any". All of this information is contained in the tag itself, which is then the merge request made by the maintainer when the maintainer merges the pull request. Please write it well as it will remain in the kernel tree for the future.

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.

Anyway, at least for me, the important thing is the "message". I want to understand what I'm pulling and why I have to pull it. I also want to use it as a message for merge, which should not only make sense to me, but also as a history.

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.

If you feel something is wrong with the pull request, it will appear in the description. If you work with files that you do not maintain, please state "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 check with diffstat anyway, and if I didn't mention it, I would be more suspicious. Also, if you send a new stuff after sending a merge window (or a bugfix, but it looks very dangerous), in addition to "what to do" and "why to do so" Please also explain "timing". Why 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.

It uses both a pull request in the email and a signed tag, so you can write your work inside the signed tag, depending on your workflow (it will also be automatically sent to the pull request email). Alternatively, you can turn the signed tag into a placeholder that doesn't contain anything interesting and explain the work later when you actually submit 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.

And of course I edit the message. Sometimes it's trivial formatting (indentation or whole quote), but sometimes some of the message is understandable when pulled (tailing about personal issues that I'm trying to send immediately with conflict). The context of the merge commit message doesn't make sense, so I try to make it meaningful.

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.

Correct any noticeable typographical errors and incorrect grammar, especially if you are not a native speaker (even if you are a native speaker). However, I also miss some and 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.

There is a major fix for char / misc patch ∧ for 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:

This includes the usual new feature set added to all crazy drivers, as well as the following 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

--time_travel_controller: A driver set for the latest time travel bus architecture that provides I / O to the CPU before it is requested for 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.

--relativity_shifters: Due to the system-wide impact of time_travel_controllers, a new set of relativity shifter drivers was needed to accommodate newly formed black holes that could inhale CPU. This subsystem handles this in a way that neutralizes the problem. There is a Kconfig option that forces them to be enabled when needed, so the problem does 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.)

These patches have been tested on all the latest linux-next releases and all the original issues found have been resolved. (There was no corresponding Kconfig option in the latest version of linux-netxt tree, so I'm sorry if you put it near Canberra)

Signed-off-by: Your-name-here [email protected]

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.

The tag message format is similar to git commit id. Be sure to sign off with one line at the top, "Summary Subject" and at the bottom.

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

Now that we have a local signed tag, we need to push it to a place where we can launch it.

git push origin char-misc-4.15-rc1

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:

The last thing to do is create a pull request message. git makes this easy using the git request-pull command. However, I need a little help in deciding what to pull and what to base it on (to see the correct changes to be pulled and the diffstat). The following command generates 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).

This requires git to use the git: // protocol for pull to compare the differences from the'char-misc-4.15-rc1' tag location to the beginning of the master branch. (In my case, it was the last place in the branched linux tree, usually -rc release). If you want to use https: // instead, you can replace it (be aware that some people have firewall issues with https git pull).

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.

If the repository doesn't have the char-misc-4.15-rc1 tag, it will check when pulling, git will complain if it isn't there. In fact, it's useful to remember to push 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.

The output of'git request-pull'includes the location of the git tree, the specific tag to pull, and the full text. A description of the tag (that's why the tag needs to provide the appropriate information). It also creates a diffstat for the pull request and a short log of the individual commits provided by the pull request.

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.

Linus replied that he tends to prefer the git: // protocol. Other maintainers may have different tastes. Also, keep in mind that https: // may be more suitable if you want to make a pull request without a signed tag. See the original thread for more information.

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:

The pull request is sent in the same way as a regular patch. Send it to the maintainer as an in-line email and, if necessary, send CC LKML and a subsystem-specific list. A pull request to Linus typically has the following subject line:

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

Recommended Posts

Creating Pull Requests
requests