我如何从 git 中检出一个源代码树(没有回购历史等)

How do I checkout just a source tree from git (without the repo history, etc.)

我正在使用 git 存储库,该存储库检出时超过 100GB。我没有足够的 space 磁盘来保存整个 repo,我只需要读取它,我永远不会提交。我怎样才能 git 只检查文件的当前状态,而不是整个历史记录?

尝试浅克隆:

git clone --depth 1 <repository>

这将以 1 个修订版本的历史深度进行克隆,而不是存储库的完整历史。