The Skara CLI tools features the tool git pr create for creating pull requests. The option
git pr create makes the title of pull request consist of "Backport" and the given hash, for example
git pr create --backport=5a526c1c5716f6d9a7fc94741bcdb2f424d342df creates a pull request with the title "Backport 5a526c1c5716f6d9a7fc94741bcdb2f424d342df". The value of
--backport does not have to be a full hash, it can be an abbreviated hash or a reference.
Unknown or Missing Original Commit
In certain cases, the original commit for a fix is not publicly available, but a "backport pull request" still needs to be created. For this case, there is an alternate format for the pull request title: "Backport <issueId>" (e.g. "Backport JDK-1234567"). This will initiate the pull request as a "backport pull request", but without any reference to the original commit. This means that the commit message will also not contain the
Backport-of trailer. The only real advantage of declaring a pull request in this way, compared to a normal pull request, is to avoid getting a warning about the issue not being open, and of course to clearly communicate to reviewers the intent of the change being a backport. Omitting the backport declaration for this kind of pull request will not affect the format of the commit message, nor how a backport issue is created in JBS.
Backport Commit Command
The /backport commit command can be used to quickly create a backport pull request for a given commit. Just navigate to the commit in source code hosting provider's web UI and add a comment consisting of "/backport <repo>". If the commit does not apply clean on the target repository then a message will be shown for the files with conflicts.