Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send one pull request per separate commit?

I forked a project. I worked on it for a bit.

I now have ten different commits, each of which is independent of the other commits. I'd like to send each individual commit as a separate pull request, to let the maintainer of the upstream choose which ones he/she wants.

I can't find an easy way to do this.

The "easiest" I can find is to create ten separate branches, and cherry-pick each of the ten separate commits into those branches, and then send a pull request from each.

That's ... not sane! (See for example how to divide one pull request into two different pull request on github )

The underlying git request-pull function supports this workflow, so is the problem here that GitHub just doesn't have a good interface to this? Am I doomed to create ten branches?

like image 951
Jon Watte Avatar asked May 19 '15 23:05

Jon Watte


People also ask

How do I create a pull request only for a specific commit?

In the "Branch" menu, choose the branch that contains your commits. Above the list of files, click Pull request. Use the base branch dropdown menu to select the branch you'd like to merge your changes into, then use the compare branch drop-down menu to choose the topic branch you made your changes in.

How do I create a pull request for multiple commits?

A pull will pull all the commits, including their dependencies - it won't cherry-pick individual commits. So if you want to request that only your commits be pulled, and there are other people's commits in the same branch, you have to first separate your commits into a different branch. Yes, it will.

Can I raise 2 pull requests from same branch?

There can be only one open PR from a given branch.

How many commits Should a pull request have?

Have one commit per logical change and one major feature per pull request. When you submit a pull request, all the commits associated with that pull request should be related to the same major feature.


1 Answers

GitHub's Pull Requests are designed to be per-branch, not per-commit. This is deliberate:

After your pull request is sent, any new commits pushed to your branch will automatically be added to the pull request. This is especially useful if you need to make more changes.

If you want to send ten Pull Requests in GitHub you'll have to do it using ten branches. The only exception would be if you wait for each Pull Request to be merged before submitting the next one.

like image 75
Chris Avatar answered Oct 21 '22 05:10

Chris