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

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

当前回答

git branch -r表示对象名称无效, 因为该分支名称不在 Git 的本地分支列表中。 更新您的本地分支列表来源 :

git remote update

然后再试着检查一下你的远程分支

这对我管用

我相信git fetch拉拉进全部( 全部)远端树枝,这不是最初的海报所要的。

其他回答

我用了那个:

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 fetch && git checkout your-branch-name

git fetch --all

将所有远程分支都带回您的本地

git checkout test

将您切换到测试分支

如果远程分支名称是以特殊字符开头的,您需要在退出命令中使用单引号,否则Git将不知道您在谈论哪个分支。

例如,我试图查看一个远程分支 命名为#9773,但如下图所示,命令没有正常工作:

Enter image description here

出于某种原因,我想知道尖锐符号(###)是否与它有关,然后我试图用单引号绕绕分支名称,例如'#9773'而不是仅仅#9773幸运的是,它的工作很好。

git checkout -b '#9773' origin/'#9773'

命令

git fetch --all
git checkout -b <ur_new_local_branch_name> origin/<Remote_Branch_Name>

等于

 git fetch --all

时和时

 git checkout -b fixes_for_dev origin/development

两者将创造latest fixes_for_dev调自development