Skip to main content
https://badge.fury.io/py/git-pull-request.svg

git-pull-request is a command line tool to send GitHub or Pagure pull-request from your terminal.

Installation

Use the standard Python installation method:

pip3 install git-pull-request

Although it might not be up to date with the latest code on GitHub Fedora 28+ users can also download straight via package manager DNF:

sudo dnf install git-pull-request

Usage

Once you’ve made your commits into a branch, just type:

git pull-request

This will:

  1. Fork the upstream repository into your account (if needed)

  2. Add your forked repository as a remote named “github” (if needed)

  3. Force push your current branch to your remote

  4. Create 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 run git pull-request to update your pull-request. git-pull-request automatically detects that a pull-request has been opened for your current working branch.

Workflow advice

Caching Credentials

GitHub has a good documentation about using git credential.

The full documentation is available on the git-scm.com website.

GitHub

If you set up 2-Factors Authentication for your GitHub account, you should create a personal token and request the repo permission, then use that as your password.

Pagure Token

Pagure uses API key, you need to create one by visiting your settings and requesting the Fork a project and Modify an existing project ACL.

Creating Branches

When sending pull-requests, it’s preferable to do so from your own branch. You can create your own branch from master by doing:

$ git checkout -b myownbranch --track origin/master

This will checkout a new branch called myownbranch that is a copy of master. Using the –track option makes sure that the upstream source branch is written in your .git/config file. 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 a git nb alias 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 via git config

Most git-pull-request command line arguments can be store into your git configuration.

For a particular repository, if you get tired of using:

$ git pull-request --fork never

You can set the option with git and use the command without any arguments:

$ git config git-pull-request.fork never
$ git pull-request

You 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-request

Difference with hub

The wrapper hub provides hub fork and hub pull-request as 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 calling hub pull-request would just open a new pull-request.

git-pull-request wraps all of these operations into one convenient tool.

Metadata

Release files for git-pull-request 6.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git-pull-request 6.0.2
File Size Uploaded
git-pull-request-6.0.2.tar.gz 25.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git-pull-request 6.0.2
File Interpreter ABI Platform
git_pull_request-6.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 47.5 kB

Release files / git-pull-request-6.0.2.tar.gz

Download URL git-pull-request-6.0.2.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e0c8fd5122a6783e9a92660cd43b94a933d6aadebfd1bb07d276fc60c1013973
BLAKE2b-256 checksum
How to use checksums
4f09cbf25eee09ab6448bf66186582ee7413c958a4d115fcf1287bb9c8781aba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release files / git_pull_request-6.0.2-py2.py3-none-any.whl

Download URL git_pull_request-6.0.2-py2.py3-none-any.whl
Size 21.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
10ddf275f1904223a656fcfdf8a4afd013247b4953be122fee289a87c1e417f6
BLAKE2b-256 checksum
How to use checksums
67ba5058fd0ffd498ff729c90e47e5604c638fe5b421fd5c7cdc4fd992dae73e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

Release history Release notifications | RSS feed

This release

6.0.2 This release

2 release files

6.0.1

1 release file

6.0.0

1 release file

5.0.1

2 release files

5.0.0

2 release files

4.4.0

2 release files

4.3.0

2 release files

4.2.1

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.0.1

1 release file

3.0.0

2 release files

2.10.0

2 release files

2.9.1

2 release files

2.9.0

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

1 release file

2.1.0

1 release file

2.0.0

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page