Skip to main content

Command line tool to send GitHub pull-request

Project description

Build Status https://badge.fury.io/py/git-pull-request.svg

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

Installation

Use the standard Python installation method:

pip3 install git-pull-request

Usage

You need to write your GitHub credentials into your ~/.netrc file. In case you have 2FA enabled, make sure to replace your password by a Personal access token:

machine github.com login jd password f00b4r

Note: since credentials are stored in plain text, you should encrypt your $HOME directory to improve security.

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

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'

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git-pull-request-2.9.2.dev1.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

git_pull_request-2.9.2.dev1-py2.py3-none-any.whl (15.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file git-pull-request-2.9.2.dev1.tar.gz.

File metadata

  • Download URL: git-pull-request-2.9.2.dev1.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.6

File hashes

Hashes for git-pull-request-2.9.2.dev1.tar.gz
Algorithm Hash digest
SHA256 33d738eaedd241cb2159568ca3e1faac179deeec62bc090da55e7e19e8daa12c
MD5 9a637b31426f3ea1877b04ef4eabef19
BLAKE2b-256 7dee600f8f0f4b7578d479aa0dc7328028815ab95763793562299c3d25f7fb0f

See more details on using hashes here.

File details

Details for the file git_pull_request-2.9.2.dev1-py2.py3-none-any.whl.

File metadata

  • Download URL: git_pull_request-2.9.2.dev1-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.6

File hashes

Hashes for git_pull_request-2.9.2.dev1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d50e3be22f701e411e7ebc0009d54031f373fc052e913ae45851b03cc197ebe8
MD5 fd5cd3af25143b26f13e9dd864ccf8f8
BLAKE2b-256 fda8d789014f0bea7a5bba7f2d91407040f838c24d3783742e09f735db2c57a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page