Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github pull request for a branch of a branch

My git log looks like this:

-------> develop
\---> A
    \---> B

Branch A is based off of develop, and is being reviewed in a pull request. In the meantime, I need to develop more stuff off of the branch, so I create Branch B. There is also a pull request for Branch B into develop, which includes the commits for both Branch A and Branch B.

The review of branch A finishes, and it is merged into develop, at which point, Github says that I need to merge develop into branch B, but if I do this, then usually it generates a lot of merge conflicts and can be difficult to untangle.

Is there a way to do pull requests for both Branch A and B simultaneously, without Branch B's pull request getting confused when Branch A merges in?

like image 708
hgcrpd Avatar asked Sep 12 '25 01:09

hgcrpd


1 Answers

I see a problem with the workflow here. Why are you merging a branch into something other than the branch it was created off?

Changing the workflow like this can get everything working smoothly:

  1. Create branch A off develop
  2. Make the changes (if there's any) that would be needed for developing the "more stuff" you referred to on a different branch
  3. Create branch B off A
  4. Go to the pull request for merging A into develop and leave a comment stating that you're developing more stuff on a branch created off A and want the reviewers to review as if A already had that stuff
  5. Develop the "more stuff" on B
  6. Create a PR for merging B into A just to make sure everything is reviewed
  7. Merge B into A
  8. Review everything one last time just in case
  9. Merge A into develop
like image 188
dorukayhan Avatar answered Sep 13 '25 16:09

dorukayhan