Home > other >  Is it possible to remove cherrypicked commits of an unmerged branch from PR?
Is it possible to remove cherrypicked commits of an unmerged branch from PR?

Time:10-23

I have an old branch old_main --> branch A commits which is X commits behind main and not merged yet.

I have a new branch updated_main --> branch B commits. I need to use branch A commits in this branch B, so I rebased. Now I have something like updated_main --> branch A commits --> branch B commits.

When I create a PR for branch B, the commit history includes the commits from branch A, which should not be reviewed in this PR.

Is it possible to remove branch A commits from the history while still using the changes?

CodePudding user response:

It's not possible. If you only want to see the changes specific to your PR, you'll have to wait for Branch A's PR to complete before you'll be able to isolate only Branch B's commits in a PR.

However, that doesn't mean you can't start the review process on Branch B. You could still create the PR and put a comment in asking the reviewers to review specific commits in Branch B rather than all the files. That way you can begin the review process, especially if you anticipate suggested changes. Once Branch A's PR is completed, if the commit IDs didn't change, those commits should fall out of Branch B's PR. If the commit IDs did change, simply rebase B onto the updated main once more and then you can finalize Branch B's PR.

  • Related