I pose this scenario:
I have two branches in the upstream repo:
develop
master
My task is to create two pull requests, one against develop, and one against master.
So i create two branches in my local:
git checkout -b develop-local
git checkout -b master-local
Now for some reason, I made the (identical) changes in both local repos manually, push to my origin and created pull requests for each.
If I am now required to create another change in develop-local on top of the already-made changes, can I cherry-pick this latest develop-local commit over to master-local?
How does cherry pick determine when cherry-picking is allowed?
Given that the extra commit you made to develop
locally is just a regular commit (and not something like a merge commit), there is no reason why cherry picking should not work here:
# from master (local)
git cherry-pick develop
The above command will actually make a new commit on top of master
, functionally corresponding to the HEAD commit in develop
which you just made. You may now push your local master
branch to GitHub, and the pull request should be updated automatically.