Let's say I have a fork of a repo, and my repo has three branches:
branch_1 is off of upstream/master, but branch_1_a is off of branch_1 (ie, it was created via git checkout -b branch_1_a branch_1)
How do pull requests work in this scenario if say I want to create a pull request for the changes in branch_1 and also a pull request for the changes in branch_1_a. Do I first have to create a PR to merge branch_1_a into branch_1? Or do I create PR for branch_1, have that merged into upstream/master, and then create a PR for branch_1_a? Or can I have a PR for each simultaneously to go into master (though I can't wrap in my mind how this would work)?
first of all, git doesn't know any "pull requests" (this is a concept of services such as gitlab, github, bitbucket,...).
instead git knows merges.
a pull request is just a way to tell someone in charge that you want to git merge a branch with another.
second, a branch is really just a label you give to a set of patches.
now, to answer your question: yes it is totally possible to merge branches and subbranches.
in the simplest case, branch_1_a contains the entirety of branch_1 (that is: all commits that are in branch_1 are also in branch_1_a).
if you first merge branch_1_a, then merging branch_1 will become a no-op (since your master now already contains branch_1).
if you first merge branch_1, then merging branch_1_a will simply add the additional patches that make branch_1 different from branch_1_a.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With