Skip to content

Splitting (Breaking down) Pull Requests

Maxim Belkin edited this page Jan 23, 2019 · 6 revisions

Sometimes maintainers will ask you to break your Pull Request (PR) into smaller ones. To do that, please follow the steps outlined below.

  1. Do a soft-reset to the beginning of the branch you used for submitting the original Pull Request (your-PR-branch):

    git reset --soft $(git merge-base gh-pages your-PR-branch)
  2. Create a new branch for a (smaller) pull request:

    git checkout -b new-branch1 gh-pages
  3. (Optional | Advanced) If you need to unstage some of the changes from the files you modified, do so with git reset -p. If you need to stage in (add to the "Staging area") some new changes, do so with git add -p

    git reset -p HEAD some-file.ext 
    # or
    git add -p some-other-file.ext
  4. Commit a subset of files for a (smaller) pull request:

    git commit -m "Message" some-file.ext some-other-file-if-needed.ext
  5. Repeat steps 2 through 4 using different branch names and files.

  6. Rebase branches created in step 5 on top of the gh-pages branch:

    git rebase gh-pages new-branch2
    git rebase gh-pages new-branch3

    Do not rebase the first branch (called new-branch1 in these notes).

Clone this wiki locally