美文网首页
shallow clone后拉取远程分支

shallow clone后拉取远程分支

作者: 刘崴_4043 | 来源:发表于2019-08-29 14:58 被阅读0次

参考:https://stackoverflow.com/questions/23708231/git-shallow-clone-clone-depth-misses-remote-branches

1. 执行

git remote set-branches origin '*'

2. fetch从远程拉取分支

git fetch

3. 切换到分支

git checkout -t origin/<branch_name>

原理:

打开shallow clone的.git/config,会看到一下一行:

fetch = +refs/heads/master:refs/remotes/origin/master  

指定fetch的时候只更新master分支

调用remote set-branches后,该设置变成:

fetch = +refs/heads/*:refs/remotes/origin/*

即获取所有分支

相关文章

网友评论

      本文标题:shallow clone后拉取远程分支

      本文链接:https://www.haomeiwen.com/subject/iuyiectx.html