如何使用git签出GitHub拉取请求? [英] How can I check out a GitHub pull request with git?
问题描述
我想签出先前创建的拉取请求(通过GitHub Web界面创建).我搜索并找到了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.
这篇关于如何使用git签出GitHub拉取请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!