有人推了一个分行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)
当前回答
你基本上看到了树枝,但你还没有本地的拷贝!
你需要,你需要fetch
分支...
您可以简单地获取并退出分支, 使用下面的一条线命令来做到这一点 :
git fetch && git checkout test
我还创建了下面的图像 让你分享差异,看看如何fetch
以及它是如何与pull
:
其他回答
您可以开始跟踪所有远程分支, 使用以下 Bash 脚本 :
#!/bin/bash
git fetch --all
for branch in `git branch -r --format="%(refname:short)" | sed 's/origin\///'`
do git branch -f --track "$branch" "origin/$branch"
done
以下是单线版本:
git fetch --all; for branch in `git branch -r --format="%(refname:short)" | sed 's/origin\///'`; do git branch --track "$branch" "origin/$branch" ; done ;
运行这两个命令,你应该可以去。
git checkout <branch-name>
git pull <remote> <branch-name>
我用了那个:
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
我不确定,我日复一日地做这个,下面的命令就像宝石一样
dev ,dev ,dev ,dev ,dev ,dev是您想要检查的分支 。
git fetch && git checkout dev
我被困在一个状况中看到error: pathspec 'desired-branch' did not match any file(s) known to git.
以上所有建议。我正在讨论Git 1.8.3.1版本。
所以这个为我工作:
git fetch origin desired-branch
git checkout -b desired-branch FETCH_HEAD
背后的解释是,我注意到 当我拿起遥控树枝时,时前:
git fetch origin desired-branch
From github.com:MYTEAM/my-repo
* branch desired-branch -> FETCH_HEAD