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

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

当前回答

我用了那个:

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

其他回答

有许多替代办法,例如:

  • 备选案文1:

    git fetch && git checkout test
    

    这是最简单的办法

  • 备选案文2:

    git fetch
    git checkout test
    

    是一样的,但分两步走

主题说明:与现代基特()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

缩略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

我不确定,我日复一日地做这个,下面的命令就像宝石一样

dev ,dev ,dev ,dev ,dev ,dev是您想要检查的分支 。

git fetch && git checkout dev

你可以试试

git fetch remote
git checkout --track -b local_branch_name origin/branch_name

git fetch
git checkout -b local_branch_name origin/branch_name