How can I git clone the PR which haven't been merged by the author in github? Tried to fork a repo but the pr is gone.
clone then fetch that PR to a local branch. For example:
git clone https://github.com/mimblewimble/grin
git fetch origin pull/2932/head:pr2932
git checkout pr2392
Note:
https://github.com/mimblewimble/grin with your source
repo2932 with your source Pull Request numberpr2932 with your desired branch nameI was looking for a single command to clone a single branch of a PR, but it seems not exist (please let me if somebody know that trick).
By "clone the PR", I assume you mean: "having my local clone of the project at the state of a given PR".
You clone a repository, not a Pull Request. Git itself has no notion of Pull Request. However, the Pull Request is probably associated with a branch, so you can do:
git clone url/of/your/repo destinationDirectory
cd destinationDirectory
git checkout branchOfThePR
If you already have a clone, then, as @JB Nizet said, you need to fetch the new branches:
git fetch remoteName
Then you can check the branch out:
git checkout branchOfThePR
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With