如何使用 git 检查 GitHub 拉取请求?
我想查看之前创建的拉取请求(通过 GitHub 网络界面创建).我搜索并找到了 refs/pull 或 refs/pull/pr
I'd like to check out a previously created pull request (created via GitHub web interface). I searched and found different places where a refs/pull or refs/pull/pr
但是当我将 fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
添加到 git 配置文件并执行 git fetch
But when I add fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to the git config file and do a git fetch
我做错了什么?GitHub 应该自动创建 pull/xyz 的东西,还是我必须配置一些东西?
What I'm doing wrong? Should GitHub create automatically the pull/xyz stuff, or do I have to configure something?
要将远程 PR 提取到本地存储库中,
To fetch a remote PR into your local repo,
git fetch origin pull/$ID/head:$BRANCHNAME
其中 $ID
是拉取请求 ID,$BRANCHNAME
是您要创建的新分支的名称.创建分支后,只需
where $ID
is the pull request id and $BRANCHNAME
is the name of the new branch that you want to create. Once you have created the branch, then simply
git checkout $BRANCHNAME
有关更多信息,请参阅官方 GitHub 文档.
See the official GitHub documentation for more.