该git clone --depth命令选项说
--depth <depth>
Create a shallow clone with a history truncated to the specified number of revisions.
A shallow repository has a number of limitations
(you cannot clone or fetch from it, nor push from nor into it),
but is adequate if you are only interested in the recent history of a large project with a long history,
and would want to send in fixes as patches.
Run Code Online (Sandbox Code Playgroud)
为什么浅克隆有这种限制?为什么它只是一个补丁工作流程?
对于某些项目工作流程,我需要将最新的提交从单个分支传递给编码器,然后让它们能够push(快进)开发到主服务器.这部分是为了安全,知识产权保护和回购规模,部分是为了减少大回购会给天真编码员带来的困惑.是否有允许这样的git工作流程?
更新:根据Karl Bielefeldt的回答,git checkout --orphan …
我已经完成了一个大型 repo ( git clone --depth 1 git@github.com:myOrg/myRepo.git)的浅层克隆。我可以向遥控器推送新的更改,但第一次推送非常慢。后续推送就好了。该命令表示第一次推送向远程写入了大量数据:
$ git checkout -b test && \
touch tmp.txt && \
git add tmp.txt && \
git commit -m tmp && \
git push origin test
Enumerating objects: 164300, done.
Counting objects: 100% (164300/164300), done.
Delta compression using up to 12 threads
Compressing objects: 100% (93987/93987), done.
Writing objects: 100% (164300/164300), 368.72 MiB | 139.00 KiB/s, done.
Total 164300 (delta 41183), reused 164297 (delta 41182)
remote: Resolving deltas: 100% (41183/41183), done. …Run Code Online (Sandbox Code Playgroud) 是否有可能做到这一点?我有一些分支和很多提交,我正在尝试,
git push - --all origin但我得到了shallow update not allowed.
提前致谢.
我有一个项目,我无法访问git存储库.我想把它放在一个新的存储库(在Bitbucket上),但是当我试图git push -u origin --all获得! [remote rejected] master -> master (shallow update not allowed)所有分支时.
显然有一个receive.shallowUpdate配置选项,但如何在远程端设置它?
制作unhallow克隆不是一种选择,因为我无法访问原始的repo.