有人将一个名为testwith 的分支推git push origin test送到共享存储库.我可以看到分支git branch -r.
现在我正试图检查远程test分支.
我试过了:
git checkout test 什么都不做
git checkout origin/test给* (no branch).这令人困惑.我怎么能在"没有分支"?
如何查看远程Git分支?
我想从GitHub克隆一个存储库.问题是我不想要主分支; 我希望这个未经批准的拉取请求中的版本.
我可以克隆拉取请求版本而不是主存储库吗?
我需要在NServiceBus repo中提取一个特定的pull请求(尚未处理到主流中):
https://github.com/johnsimons/NServiceBus/commit/d8524d53094e8181716e771c1023e968132abc15
这显然不是我的回购,但我需要拉动请求中存在的更改.
做这个的最好方式是什么?
当包位于子文件夹中时,是否可以从github安装npm包?
例如,我们有Microsoft BotBuilder存储库:https: //github.com/Microsoft/BotBuilder
但我需要在子文件夹"Node/core /"中安装软件包:https: //github.com/Microsoft/BotBuilder/tree/master/Node/core/
那么如何用npm安装呢?
虽然添加fetch = +refs/pull/*/head:refs/remotes/origin/pr/*到.git/config允许获取和结帐,但拉动操作失败:
[remote "origin"]
url = https://github.com/the/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
Run Code Online (Sandbox Code Playgroud)
获取和结帐工作正常:
$ git fetch origin
Run Code Online (Sandbox Code Playgroud)
... 都好
$ git checkout -b "pr-123" origin/pr/123
Branch pr-123 set up to track remote branch pr/123 from origin.
Switched to a new branch 'pr-123'
Run Code Online (Sandbox Code Playgroud)
...成功,得到了代码!
但拉动失败:
$ git pull
Your configuration specifies to merge with the ref 'refs/heads/pr/123'
from the remote, but no such ref was fetched.
Run Code Online (Sandbox Code Playgroud)
......失败了.
我可以手动指定ref:
$ git pull origin refs/pull/123/head …Run Code Online (Sandbox Code Playgroud) 我正在使用 GitHub 托管一些项目,有人分叉了我的存储库并提交了 PR。我以前从未需要在 fork 中测试 PR。我如何检查分支并测试它?我可以如何将其放入我的仓库中吗?或者我应该检查分叉并以这种方式测试分支吗?
我想使用 git 获取 Azure DevOps 托管的存储库中的拉取请求列表。
Github有支持。我们可以将其添加到.git/config:
[remote "origin"]
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
Run Code Online (Sandbox Code Playgroud)
但是当我为 Azure DevOps 尝试相同的方法时,它没有获取任何内容。我也git-pr从git-extras包装中尝试过。
我猜测如果他们有支持,路径可能与 不同。refs/remotes/origin/pr/他们有一个REST API 端点来获取拉取请求,但我找不到任何关于使用 git 执行相同操作的信息。
示例:https://github.com/BVLC/caffe/pull/1731
有时我需要提取这种拉取请求,因为我打开了一个问题,而其他人提供了修复.然后项目合作者可能会要求我在合并之前验证修复是否有效.那么如何拉取这些拉取请求而不是手动对我的本地存储库进行更改呢?
git ×9
github ×7
pull-request ×4
azure-devops ×1
git-checkout ×1
git-fork ×1
git-pull ×1
npm ×1