Skip to main content

Stack diff support for GitHub

Project description

ghstack

Conveniently submit stacks of diffs to GitHub as separate pull requests.

pip install ghstack

How to use

Prepare a series of commits on top of master, then run ghstack. This tool will push and create individuals for each PR on the stack.

WARNING. You will NOT be able to merge these commits using the normal UI method, as their branch bases won't be master.

Structure of submitted pull requests

Every commit in your local commit stack gets submitted into a separate pull request and pushes commits onto three branches:

  • gh/username/1/base - think of this like "master": it's the base branch that your commit was based upon. It is never force pushed; whenever you rebase your local stack, we add merge commits on top of base from the true upstream master.

  • gh/username/1/head - this branch is your change, on top of the base branch. Like base, it is never force pushed. We open a pull request on this branch, requesting to merge into base.

  • gh/username/1/orig - this is the actual commit as per your local copy. GitHub pull requests never sees this commit, but if you want to get a "clean" commit all by itself, this is an easy way to get it.

Developer notes

We have tests, using a mock GitHub GraphQL server! How cool is that? Run these tests using python test_ghstack.py

Design constraints

There are some weird aspects about GitHub's design which lead to unusual design decisions on this tool.

  1. When you create a PR on GitHub, you cannot subsequently change which repository it merges into (you can change which branch merges into). This means you have a hard choice when designing a tool like this: if you want to target the topmost PR to master, you must push branches onto the origin repo; if you give up on this, you can push branches into a fork. We've decided to give up targets to master so that we can push the branches to your fork.

    (Actually, this is a lie; we still push to origin lol.)

  2. Branch name does not correspond to pull request number. While this would be excellent, we have no way of reserving a pull request number, so we have no idea what it's going to be until we open the pull request, but we can't open the pull request without a branch.

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

ghstack-0.0.5.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

ghstack-0.0.5-py2-none-any.whl (13.3 kB view details)

Uploaded Python 2

File details

Details for the file ghstack-0.0.5.tar.gz.

File metadata

  • Download URL: ghstack-0.0.5.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.4.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

File hashes

Hashes for ghstack-0.0.5.tar.gz
Algorithm Hash digest
SHA256 1dd3f6caa119879a7d2748a037f4e023a286fb74a4ec7cf79afc7a6bc81cd756
MD5 436d64b729604f722e5d34c8202230dc
BLAKE2b-256 e10fc848789f7ac326e32f4248d0d8a3adc64b2b27fcd04993dd3afecd2a45c8

See more details on using hashes here.

Provenance

File details

Details for the file ghstack-0.0.5-py2-none-any.whl.

File metadata

  • Download URL: ghstack-0.0.5-py2-none-any.whl
  • Upload date:
  • Size: 13.3 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.4.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

File hashes

Hashes for ghstack-0.0.5-py2-none-any.whl
Algorithm Hash digest
SHA256 f8c927c7e004889916c79a87112f4656dbc73ce72e3ddb46ee55e4cbd2982d6c
MD5 4394364cbf8d6650f0aa8022f3f2ed58
BLAKE2b-256 902d47fc8544fd924215d85f88ea958838dea3b5915286e480b02bd459016ad4

See more details on using hashes here.

Provenance

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