在浅git fetch之后,无法部署(checkout)代码和分支仍然缺失

时间:2015-04-13 11:06:05

标签: git deployment fetch git-fetch shallow-clone

我快速设置了存储库:

git init
git remote add origin git@bitbucket.org:bbaccount/svgopt.git
git fetch origin display-channel --depth 1
remote: Counting objects: 85, done.
remote: Compressing objects: 100% (82/82), done.
remote: Total 85 (delta 5), reused 47 (delta 0)
Unpacking objects: 100% (85/85), done.
From bitbucket.org:bbaccount/svgopt
 * branch            display-channel -> FETCH_HEAD

然后,当我试图获取代码时:

git checkout display-channel

我明白了:

error: pathspec 'display-channel' did not match any file(s) known to git.

我已经检查过,尽管git fetch日志输出,但该分支似乎不是本地可用的:

git branch -a

什么都不返回。我希望只从单个分支获取最新的代码(没有理由全部拉出来) - 我可以不这样做吗?

1 个答案:

答案 0 :(得分:0)

终于找到了解决方案。应该用过:

git checkout display-channel:display-channel

相反,它添加/更新分支:

remote: Total 0 (delta 0), reused 0 (delta 0)
From bitbucket.org:bbaccount/svgopt
* [new branch]      display-channel -> display-channel