Cherry pick a pull request
I don't know if this is the best way to do this, but here goes. Suppose we have a pull request that has already been merged into main
, and now we want to open another pull request with the same set of commits, but this time we want to open it against the release
branch.
Find the sha of the merge commit.
Switch to
release
, and create a new branch.shgit checkout release git checkout -b backport-foo
Cherry pick using
-m 1
. Note that this'll create a single commit that references the merge, this'll not cherry pick the individual commits. This might not be what you want, but that was enough for my current purpose.shgit cherry-pick -m 1 <merge-commit-id>
Open a pull request against release. You can do it from the GitHub's web UI, or via their CLI.
shgit push -u origin HEAD gh pr create --base release --fill --web