有人推了一个分行test
与git push origin test
共享仓库的共享仓库。git branch -r
如何查看遥控器test
我试过了
git checkout test
,它没有做任何事情git checkout origin/test
给给* (no branch)
有人推了一个分行test
与git push origin test
共享仓库的共享仓库。git branch -r
如何查看遥控器test
我试过了
git checkout test
,它没有做任何事情git checkout origin/test
给给* (no branch)
当前回答
你可以试试
git fetch remote
git checkout --track -b local_branch_name origin/branch_name
或
git fetch
git checkout -b local_branch_name origin/branch_name
其他回答
我尝试了上面的解决方案,但行不通。试试这个,它奏效了:
git fetch origin 'remote_branch':'local_branch_name'
这将获取远程分支, 并创建一个新本地分支( 如果尚未存在) 名称local_branch_name
并追踪其中的遥控者。
在我看来,没有人建议 最简单的方法(也许我太笨了 觉得这太蠢了)"一种方式"但无论如何,试试这个:
git pull origin remoteBranchName
git switch remoteBranchName
这对我也有效(在我最后一次拉拉请求后,在遥控器上创建了一个分支)。
其他男人和女孩提供解决方案, 但也许我可以告诉你原因。
git 检查退出测试, 无效
Does nothing
不等于doesn't work
,所以我猜想当您在终端键入“ Gitt 检出测试” 并按键输入密钥时,没有出现消息,也没有出错。对不对?
如果答案是"是" 我可以告诉你原因
原因是在您的工作树上有一个名为“ 测试” 的文件( 或文件夹) 。
何时git checkout xxx
被弃绝,
xxx
一开始是树枝名称, 但没有任何树枝名称测试 。xxx
这是一条道路,幸运的是,有一个名为“测试”的文件。git checkout xxx
表示丢弃任何修改xxx
文件。xxx
或,然后 Git 将尝试创建xxx
根据某些规则,其中一项规则是设立一个部门,名为:xxx
如果remotes/origin/xxx
存在。如果该分支所在的事物上不是其他的,origin
我喜欢做以下工作:
$ git fetch
$ git checkout -b second/next upstream/next
这将检出next
分支上upstream
远程连接到一个本地分支,该分支被调用second/next
。这意味着,如果您已经拥有下一个命名为本地分支的分支,则不会发生冲突。
$ git branch -a
* second/next
remotes/origin/next
remotes/upstream/next
缩略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