Description
git-pr create
creates a pull request on a source code hosting site like GitLab or GitHub. The source branch for the pull request will be the currently checked out local branch. git-pr create
will for safety measures verify that there are no local changes in the worktree and that all commits to on currently checked out have been pushed to the remote repository for the personal fork (both these checks can be turned off). git-pr create
can automatically publish the currently checked out local branch when run with the flag --publish
. git-pr create can automatically run jcheck on the commits that will be part of the pull request before creating the pull request with the flag --jcheck
. If the flag --draft
is supplied then the created pull request will be a draft pull request. To manually select the mailing lists that should be CC:d for the initial "RFR" e-mail, use the --cc
flag.
git-pr create
always ends by printing the URL to the newly created pull request on standard output.
Usage
$ git pr create -h usage: git-pr [options] [<ID>] -u, --username NAME Username on host -r, --remote NAME Name of remote, defaults to 'origin' -b, --branch NAME Name of target branch, defaults to 'master' --cc MAILING LISTS Mailing lists to CC for inital RFR e-mail --backport REV Create a backport pull request for the given revision --ignore-workspace Ignore local changes in worktree and staging area when creating pull request --ignore-local-commits Ignore local commits not pushed when creating pull request --publish Publish the local branch before creating the pull request --jcheck Run jcheck before creating the pull request --draft Create a pull request in draft state --verbose Turn on verbose output --debug Turn on debugging output --version Print the version of this tool -h, --help Show this help text
Examples
Create a pull request:
$ git pr create https://github.com/openjdk/skara/pull/756
Create a pull request, but first automatically publish the branch and run jcheck on the commits:
$ git pr create --publish --jcheck Enumerating objects: 21, done. Counting objects: 100% (21/21), done. Delta compression using up to 12 threads Compressing objects: 100% (7/7), done. Writing objects: 100% (11/11), 772 bytes | 772.00 KiB/s, done. Total 11 (delta 3), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (3/3), completed with 3 local objects. remote: remote: Create a pull request for 'bugfix' on GitHub by visiting: remote: https://github.com/edvbld/jdk/pull/new/bugfix remote: To git@github.com:edvbld/skara.git * [new branch] bugfix -> bugfix Branch 'bugfix' set up to track remote branch 'bugfix' from 'origin'https://github.com/openjdk/jdk/pull/21
Configuration
All flags to git-pr create can be configured to have default values. For example, to always run jcheck on the commits before creating a pull request, run:
$ git config --global pr.create.jcheck true
Source
See GitPrCreate.java.