sprocket12
sprocket12

Reputation: 5488

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).

Upvotes: 10

Views: 19203

Answers (2)

kumarr.rakesh
kumarr.rakesh

Reputation: 21

in all likelihood, master would have evolved from release branch forcing you to have different implementation/fixes for both of them. Hence Cherry-Picking is the most widely recommended way to proceed here.

If not as is your case,

  1. get the PR for release branch merged first
  2. rebase to master and create another pull request

Upvotes: 2

Martin Peck
Martin Peck

Reputation: 11574

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

Upvotes: 4

Related Questions