Reputation: 3070
I found a source code in github. It has some pull request which indicates the changing code. I would like to download/clone one of them to my PC. Its pull request id is 3983 at the address https://github.com/BVLC/caffe/pull/3983 Thank all
Upvotes: 6
Views: 10934
Reputation: 1325996
Because, someone has more one pull request, each pull request has own ID. How can I download correct version which corresponds to pull request ID
It is better to clone the original repo, and import the PR branch based on its ID
git clone https://github.com/BVLC/caffe
cd caffe
git remote add christianpayer https://github.com/christianpayer/caffe.git
Then, for one of christianpayer's merged PR into origin:
git fetch origin pull/3983/head:pull_3983
git checkout pull_3983
You can fetch other PRs from that remote repo, or add other remote repos for fetching other PRs.
Upvotes: 13
Reputation: 2191
There are two ways to do this:
1:
git clone https://github.com/christianpayer/caffe.git
cd caffe
git checkout nd-cudnn
It is from here:
https://github.com/christianpayer/caffe/tree/nd-cudnn
2:
git clone https://github.com/BVLC/caffe.git
cd caffe/.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to config
[remote "origin"]
url = https://github.com/BVLC/caffe.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
Now fetch all the pull requests:
$ git fetch origin
From github.com:joyent/node
* [new ref] refs/pull/5190/head -> origin/pr/5190
* [new ref] refs/pull/5193/head -> origin/pr/5193
* [new ref] refs/pull/5198/head -> origin/pr/5198
* [new ref] refs/pull/520/head -> origin/pr/520
...
To check out a particular pull request:
$ git checkout pr/3983
Branch pr/3983 set up to track remote branch pr/3983 from origin.
Switched to a new branch 'pr/3983'
Upvotes: 1