Command line tool to send GitHub pull requests
Project description
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:
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 remote
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.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file git-pull-request-4.4.0.tar.gz
.
File metadata
- Download URL: git-pull-request-4.4.0.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 734a70deada1d2e735675d5d5824609939ae9636f39b877464b44cc647c47378 |
|
MD5 | 008e22d6330b9b42ba9f885d545aafdf |
|
BLAKE2b-256 | 8291e2651da5d5d3552eedd9bba3091fb1fcd583115dce446f3756ea6f96196b |
File details
Details for the file git_pull_request-4.4.0-py2.py3-none-any.whl
.
File metadata
- Download URL: git_pull_request-4.4.0-py2.py3-none-any.whl
- Upload date:
- Size: 19.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.1 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3e1d7246a13b4f7b3888054a83320d969a2bfdbaa3731a729cba00af19bde85 |
|
MD5 | 29c36389498437cd573d591fe05aca47 |
|
BLAKE2b-256 | c53f12314afb1d1dd8f9434c188e8f0120d7a139f49d00e40b71dd01957e4789 |