Pull request on a branch which got cherry picked commits merged

Viewed 169

I initiated a feature development in BranchA, but I included some 'clean up' and 'tweaking' commits on it.

In the middle of the process 'tweaking' commits needed to be merged into the master (by doing a pull request) so I created a BranchB with some new commits and cherry picked some of the commits done in BranchA.
BranchB was merged with no conflicts.

My question is: How to handle the BranchA pull request?
Is it safe to submit BranchA even if some of its commits were already merged? If not, how to go through this situation?

Situation

1 Answers

Rebase branch A on B: only the commits not cherry-picked should be there.

 B--B--B--B--A'--A'--A' (A)
           \
         m--M--m--m (master)  

Then rebase A on top of master:

git rebase --onto master B A

That will rebase all commits after B HEAD, up to A HEAD (included).

 B--B--B--B (B)
           \
         m--M--m--m (master)  
                   \
                    A''--A''--A'' (A)

From there, you can make your pull-request.

Related