有人推了一个分行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 origin && git checkout --track origin/branch_name
其他回答
对我们来说,似乎remote.origin.fetch
配置存在一个问题。 因此, 我们无法看到比master
, 如此git fetch [--all]
没有帮助,也没有帮助。git checkout mybranch
英git checkout -b mybranch --track origin/mybranch
确实工作过,虽然肯定在遥远的地方。
仅允许上一个配置master
要获取的 :
$ git config --list | grep fetch
remote.origin.fetch=+refs/heads/master:refs/remotes/origin/master
通过使用来修补它*
从源头获取新信息 :
$ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
$ git fetch
...
* [new branch] ...
...
现在我们可以git checkout
本地边远分支。
我不知道这个配置怎么会 出现在我们本地的仓库里
使用 :
git checkout -b <BRANCH-NAME> <REMOTE-NAME>/<BRANCH-NAME>
其它答案在我的良性案例中不适用于现代 Git 。 如果远程分支是新的, 您可能需要先拉一下, 但我还没有检查过这个案例 。
我用了那个:
git clean -fxd # removes untracked (new added plus ignored files)
git fetch
git checkout {branchname}
git reset --hard origin/{branchname} # removes staged and working directory changes
在我看来,没有人建议 最简单的方法(也许我太笨了 觉得这太蠢了)"一种方式"但无论如何,试试这个:
git pull origin remoteBranchName
git switch remoteBranchName
这对我也有效(在我最后一次拉拉请求后,在遥控器上创建了一个分支)。
git branch -r
表示对象名称无效, 因为该分支名称不在 Git 的本地分支列表中。 更新您的本地分支列表来源 :
git remote update
然后再试着检查一下你的远程分支
这对我管用
我相信git fetch
拉拉进全部( 全部)远端树枝,这不是最初的海报所要的。