Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiple pull requests from the same branch

Say I have 3 branches: master, release and myfeature. Is it possible to create 2 pull requests from myfeature to both master and release without creating another branch?

Why might I want this?

Say master is the current latest, and release was a year ago. When a bug is fixed a PR is created against release, now this fix also needs to go into master, a cherry pick is perfect, but that will need a new branch as far as I know. I just wish it was possible to use the same original fix branch to merge into both (as long as master is still compatible).

like image 855
sprocket12 Avatar asked Mar 29 '17 12:03

sprocket12


People also ask

Can there be multiple pull requests from same branch?

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

Should I make a new branch for each pull request?

It's a good practice to create a new branch for every new bit of work you start doing, even if it's a very small one. It's especially useful to create a new branch for every new feature you start working on. Branches are of course disposable, you can always remove them.

What is stacked pull request?

Stacked Pull Requests is a workflow strategy for splitting up code changes into more reviewable units. Instead of having a single large pull request, a changeset is submitted as a series of PRs and branches, each as a patch to the previous branch. In effect, this treats changesets as a queue to be merged to master.


1 Answers

You probably want to think a little more about your branches, and why you have them.

There's nothing to stop you from creating pull requests between your branches. I assume you're creating pull requests so that you can have conversations about those changes. I guess my question is "how will the conversation be different in these two cases?"

It feels, to me, like you may want to use a PR to have a conversation as you merge changes from myfeature to master, but once that conversation has happened the merge from master to release doesn't need to occur...it's just a merge.

I wonder if you should be using tags, rather than branches, in place of release. You may also want to check out some of the following resources to define how you're going to use git to manage this sort of thing:

GitHub's docs on Pull Requests

Altasian's view on git workflows

The original post on git-flow

like image 91
Martin Peck Avatar answered Oct 15 '22 11:10

Martin Peck