Package: git-pull-request
git-pull-request is a command line tool to send GitHub orPagurepull-request from your
terminal.InstallationUse the standard Python installation method:pip3 install git-pull-requestAlthough it might not be up to date with thelatest code on GitHubFedora28+ users can also download straight via package managerDNF:sudo dnf install git-pull-requestUsageOnce you’ve made your commits into a branch, just type:git pull-requestThis will:Fork the upstream repository into your account (if needed)Add your forked repository as a remote named “github” (if needed)Force push your current branch to your remoteCreate a pull-request for your current branch to the remote matching branch,
or master by default.If you add more commits to your branch later, or need to rebase your branch to
edit commits, you’ll just need to rungit pull-requestto update your
pull-request. git-pull-request automatically detects that a pull-request has
been opened for your current working branch.Workflow adviceCaching CredentialsGitHub has a good documentation about usinggit credential.The full documentation is available on thegit-scm.com website.GitHubIf you set up 2-Factors Authentication for your GitHub account, you
shouldcreate a personal tokenand request therepopermission, then use that as your password.Pagure TokenPagure uses API key, you need to create one by visitingyour settingsand requesting theFork a projectandModify an existing projectACL.Creating BranchesWhen sending pull-requests, it’s preferable to do so from your own branch. You
can create your own branch frommasterby doing:$ git checkout -b myownbranch --track origin/masterThis will checkout a new branch calledmyownbranchthat is a copy of master.
Using the–trackoption makes sure that the upstream source branch is
written in your.git/configfile. This will allow git-pull-request to know to
which branch send the pull-request.Since this is long to type, you can use an alias in git to make it faster:$ git config --global alias.nb '!git checkout --track $(git config branch.$(git rev-parse --abbrev-ref HEAD).remote)/$(git rev-parse --abbrev-ref HEAD) -b'This will create agit nbalias that will create a new branch tracking the
current branch and checking it out. You can then use it like that:$ git nb foobar
Branch foobar set up to track remote branch master from origin.
Switched to a new branch 'foobar'Configuration viagit configMostgit-pull-requestcommand line arguments can be store into your git
configuration.For a particular repository, if you get tired of using:$ git pull-request --fork neverYou can set the option with git and use the command without any arguments:$ git config git-pull-request.fork never
$ git pull-requestYou can also set the option globally to have a custom default for all your
repositories with:$ git config --global git-pull-request.fork always
$ git pull-requestDifference with hubThe wrapperhubprovideshub forkandhub pull-requestas
command line tools to fork and create pull-requests.Unfortunately, it’s hard to combine these tools in an automated implementation for a
complete workflow.For example:
If you need to update your pull-request, there’s no way to identify existing pull requests, so
callinghub pull-requestwould just open a new pull-request.git-pull-request wraps all of these operations into one convenient tool.