有人推了一个分行testgit push origin test共享仓库的共享仓库。git branch -r如何查看遥控器test我试过了

  • git checkout test,它没有做任何事情
  • git checkout origin/test给给* (no branch)

当前回答

git 检出 -b "Branch_name" [B 意指创建本地分支]

git 分支-all

git 检出 -b “您的分支名称”

git 分支分支

git 拖拉源 "您的分支名称"

从母版分支向 dev 分支成功退出

enter image description here

其他回答

主题说明:与现代基特()1.6.6),您可以使用

git checkout test

(请注意“测试”不是“原产/测试”)DWIM DEWIM DEWIM DEWIM DEWIM DEWIM DEWIM DEWIM DEWIM DEWIM DIWIM DEWIM DIWIM DIWWM DI DIWIM DI DIWIM DI DIWIM DI DIWM DIWIM DI DIWM DI DI DIWIM DI DI DIWM-为您创建本地的“测试”分支, 上游是远程跟踪分支“ 源/ 测试 ” 。


缩略* (no branch)git branch输出是指您在未命名的分支上, 即所谓的“ 列列 HEAD ” 状态( HEAD 指点直接承诺, 而不是某些本地分支的象征性引用) 。 如果您在这个未命名的分支上做了一些承诺, 您总是可以在当前承诺中创建本地分支 :

git checkout -b test HEAD

评论意见中建议的一种更现代的方法:

@Dennis:git checkout <non-branch>,例如,git checkout origin/test产生独立的总部领导/未命名分支,而git checkout testgit checkout -b test origin/test地方分支的成果test(与远程跟踪处一起)origin/test计为上游上游- 贾库布·纳拉斯基14日8: 17

重点强调git checkout origin/test

你基本上看到了树枝,但你还没有本地的拷贝!

你需要,你需要fetch分支...

您可以简单地获取并退出分支, 使用下面的一条线命令来做到这一点 :

git fetch && git checkout test

我还创建了下面的图像 让你分享差异,看看如何fetch以及它是如何与pull:

git fetch

缩略git remote show <origin name>命令将列出所有分支(包括未跟踪的分支)。然后您可以找到要获取的远程分支名称。

示例:

git remote show origin

使用这些步骤获取远程分支 :

git fetch <origin name> <remote branch name>:<local branch name>
git checkout <local branch name > (local branch name should the name that you given fetching)

示例:

git fetch origin test:test
git checkout test

出于某种原因,我不能做:

git checkout -b branch-name origin/branch-name

它在抛出错误:

致命 : “ 来源/ 分支名称” 不是一个承诺, 无法从中创建分支“ 分支名称 ” 。

我必须这样做:

git checkout -b branch-name commit-sha

我总是这样:

git fetch origin && git checkout --track origin/branch_name