# Derrick Stolee - Get up to speed with partial clone and shallow clone (Highlights)

## Metadata
**Review**:: [readwise.io](https://readwise.io/bookreview/30962270)
**Source**:: #from/readwise #from/reader
**Zettel**:: #zettel/fleeting
**Status**:: #x
**Authors**:: [[Derrick Stolee]]
**Full Title**:: Get up to speed with partial clone and shallow clone
**Category**:: #articles #readwise/articles
**Category Icon**:: 📰
**URL**:: [github.blog](https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/)
**Host**:: [[github.blog]]
**Highlighted**:: [[2023-08-09]]
**Created**:: [[2023-08-28]]
## Highlights
- `git clone --filter=blob:none <url>` creates a *blobless clone*. These clones download all reachable commits and trees while fetching blobs on-demand. These clones are best for developers and build environments that span multiple builds. ([View Highlight](https://read.readwise.io/read/01h7bzrkrcaqdqgb5a0t03x4n9)) ^577102067
- `git clone --filter=tree:0 <url>` creates a *treeless clone*. These clones download all reachable commits while fetching trees and blobs on-demand. These clones are best for build environments where the repository will be deleted after a single build, but you still need access to commit history. ([View Highlight](https://read.readwise.io/read/01h7bzrpfg6stm579723znb641)) ^577102369
- `git clone --depth=1 <url>` creates a *shallow clone*. These clones truncate the commit history to reduce the clone size. This creates some unexpected behavior issues, limiting which Git commands are possible. These clones also put undue stress on later fetches, so they are strongly discouraged for developer use. They are helpful for some build environments where the repository will be deleted after a single build. ([View Highlight](https://read.readwise.io/read/01h7bzrtk9q2fzcxfr5awa5p4p)) ^577102373
- If you need the commit history for your build, then a treeless partial clone might work better for you than a full clone. ([View Highlight](https://read.readwise.io/read/01h7bzsxcd4xws6dtgh6bqecdk)) ^577102413
- Shallow clones skip the commit history. This makes commands such as `git log` or `git merge-base` unavailable. Never fetch from a shallow clone! ([View Highlight](https://read.readwise.io/read/01h7bzvfznh97727tjxgf33y4s)) ^577102855
- Treeless clones contain commit history, but it is very expensive to download missing trees. Thus, `git log` (without a path) and `git merge-base` are available, but commands like `git log -- <path>` and `git blame` are extremely slow and not recommended in these clones. ([View Highlight](https://read.readwise.io/read/01h7bzvvmj6g3hcv18cxdkten6)) ^577102874
- Blobless clones contain all reachable commits and trees, so Git downloads blobs when it needs access to file contents. This means that commands like `git log -- <path>` are available but commands like `git blame` are a bit slower on their first run. ([View Highlight](https://read.readwise.io/read/01h7bzw69vy049fjzkn6j31w40)) ^577103234