我想检查之前创建的拉请求(通过GitHub web界面创建)。我搜索了一下,发现不同的地方有裁判/拉或裁判/拉/pr
但是当我添加fetch = +refs/pull/*/head:refs/remotes/origin/pr/*到git配置文件并进行git取回时
我哪里做错了?GitHub应该自动创建拉/xyz东西,还是我必须配置一些东西?
我想检查之前创建的拉请求(通过GitHub web界面创建)。我搜索了一下,发现不同的地方有裁判/拉或裁判/拉/pr
但是当我添加fetch = +refs/pull/*/head:refs/remotes/origin/pr/*到git配置文件并进行git取回时
我哪里做错了?GitHub应该自动创建拉/xyz东西,还是我必须配置一些东西?
当前回答
参考Steven Penny的回答,最好创建一个测试分支并测试PR。
创建一个测试分支,将PR合并到本地。假设你在主分支上:
Git checkout -b test
让PR变更进入测试分支
Git拉原点拉/939/头:test
现在,您可以安全地在这个本地测试分支上测试更改(在这种情况下,名为test),一旦您满意,就可以像往常一样从GitHub合并它。
其他回答
如果你使用Github.com,转到“拉请求”,点击相关的拉请求,然后点击“命令行说明”链接:
我正在使用hub,一个来自github的工具:https://github.com/github/hub
使用hub在本地检出一个pull请求有点容易:
hub checkout https://github.com/owner/repo/pull/1234
or
hub pr checkout 1234
你可以使用git config命令来写一个新的规则到.git/config来从存储库中获取pull请求:
$ git config --local --add remote.origin.fetch '+refs/pull/*/head:refs/remotes/origin/pr/*'
然后就是:
$ git fetch origin
Fetching origin
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 4 (delta 2), reused 4 (delta 2), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/container-images/memcached
* [new ref] refs/pull/2/head -> origin/pr/2
* [new ref] refs/pull/3/head -> origin/pr/3
这将在你不需要命名分支的情况下获取:
git pull origin pull/939/head
如何在我的机器上获得特定的拉取请求?
假设你的起源和上游信息如下所示
$ git remote -v
origin git@github.com:<yourname>/<repo_name>.git (fetch)
origin git@github.com:<yourname>/<repo_name>.git (push)
upstream git@github.com:<repo_owner>/<repo_name>.git (fetch)
upstream git@github.com:<repo_owner>/<repo_name>.git (push)
分行的名字是
<repo_owner>:<BranchName>
then
git pull origin <BranchName>
应该做这项工作