So I have the main branch.
I usually open a new branch to get some work done, let call this branch_1.
I have now finished my work on branch_1 and open a PR to main. But while I wait I want to do more work. This new work will use the branch_1 changes, but it will not mess around the same files, let’s call this branch_2.
I have now finished my work on branch_2 and open a PR to main, but this PR includes the commits from branch_1. And both PR are pending review.
Is there a way to have my branch_2 PR not include all these commits, but still work on top of branch_1 ?
>Solution :
If branch_2 is dependent on branch_1, then you have done things correctly. You need the commits from branch_1 if you want branch_2 to work, so you should include them.
If branch_2 can stand on it’s own, you should rebase it onto main and then submit the pull request. Use caution if rebasing when dependent on branch_1 features. The rebase will eliminate the branch_1 commits, but this may also mean branch_2 is now referencing non-existent code or using features that don’t yet exist.
If branch_2 is dependent on branch_1 and you don’t want to have a pull request that depends on another pull request, merge branch_2 into branch_1 and update the branch_1 pull request appropriately.