There are 2 ways:
Using GitHub CLI gh
If local branch has the same base branch as upstream:
gh PR checkout {PR#}
Using Patch Files
If local branch diverges from the branch in which the PR is based, then we need to create patch files.
git fetch --all
git format-patch -1 <sha>
the -1 flag tells Git how many commits should be included in the patch;
-
Prepare patches from the topmost commits.
Then checkout the main/master branch and use TortoiseGit to apply the patch. Resolve any conflicts that arise.
Posted by kiatng to Git (2023-02-22 05:51)