---
title: "对旧的 repo 做 shallow clone"
description: "如果你接下来要开发的 repo 不需要完整的 git 历史，可以指定 clone 深度，只 clone 这个 repo 的 x 个 revision。"
canonical: https://oozou.com/til/shallow-clone-a-old-repo-2
locale: zh-Hans
date: 2020-10-13
topic: shell
---

# 对旧的 repo 做 shallow clone

> 如果你接下来要开发的 repo 不需要完整的 git 历史，可以指定 clone 深度，只 clone 这个 repo 的 x 个 revision。

Published: 2020-10-13 · Topic: [shell](https://oozou.com/zh-Hans/til-topics/shell) ([markdown](https://oozou.com/zh-Hans/til-topics/shell.md))

如果你接下来要开发的 repo 不需要完整的 git 历史，可以指定 clone 深度，只 clone 这个 repo 的 x 个 revision。

*git clone --depth=1 https://github.com/my/repo.git*

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/zh-Hans/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
