快速“git 克隆”从远程存储库?
我是 Git 新手。任何项目的开始工作似乎都是从“git 克隆”开始的。但这似乎需要很长时间——比同等的“svn checkout”长得多。这是因为该项目自创世以来的整个历史都被复制了吗?是否可以跳过历史记录,只获取最新文件(但保留存储库信息,允许将来拉取等)。
I'm new to Git. Starting work on any project seems to start with a "git clone". But this seems to take a long time - much longer than the equivalent "svn checkout". Is this because the entire history of the project since the dawn of time is being copied? Is it possible to skip the history, and just get the latest files (but retain repository information, allowing future pulls etc).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
git clone --depth=$NUM_REVISIONS
,它有以下注意事项:You can use
git clone --depth=$NUM_REVISIONS
, which has the following caveats:不,这是不可能的。如果您想参与存储库的历史记录,则必须拥有可以构建的完整历史记录。虽然它确实比 SVN 签出花费的时间要长一些,但它仍然相当快,除非您是通过慢速连接进行操作和/或有一个非常大的项目。
No, it's not possible. If you want to participate in a repository's history, you must have the entire history to build from. While it does take a bit longer than an SVN checkout, it's still quite fast unless you're doing it over a slow connection and/or have a really huge project.