How to open multiple pull requests on GitHub

Solution 1:

Pull requests are based on a branch.
The only way to open up a pull request for multiple commits is:

  1. Isolate them into their own branch.
  2. Open the pull requests from there.

Solution 2:

The easiest way I've found to do this is with the hub command (https://github.com/defunkt/hub).

From your topic branch ("feature" in this example) that you want to create a pull request for, you can just run:

git pull-request

(remember to push your branch first!)

And it will open a new pull request on GitHub for "YOUR_USER:feature".

If you've already created an issue on GitHub, you can even attach a pull request to that existing issue (something you can't do from the web UI):

$ git pull-request -i 123
[ attached pull request to issue #123 ]

Solution 3:

You can create Pull Request(PR), by making separate branches for your work.

Example:

  1. You checkout from a branch master into a branch work-1.

  2. You make some commits in branch work-1 as work-1-commit-1 and work-1-commit-2

  3. Now you create a PR from work-1 to master. Your code can be reviewed by seeing files changed from PR.

  4. Now, for further work you will checkout from branch work-1 into new branch work-2

  5. You make some commits in branch work-2 as work-2-commit-1 and work-2-commit-2

  6. Now you create a PR from work-2 to work-1. Your code can be reviewed by seeing files changed from PR.

Here the files changes will only have the new code you write after work-1-commit-2.