@@ -25,10 +25,29 @@ git clone https://github.com/rust-lang/rust.git
25
25
cd rust
26
26
```
27
27
28
+ ### Partial clone the repository
29
+
30
+ Due to the size of the repository, cloning on a slower internet connection can take a long time,
31
+ and requires disk space to store the full history of every file and directory.
32
+ Instead, it is possible to tell git to perform a _ partial clone_ , which will only fully retrieve
33
+ the current file contents, but will automatically retrieve further file contents when you, e.g.,
34
+ jump back in the history.
35
+ All git commands will continue to work as usual, at the price of requiring an internet connection
36
+ to visit not-yet-loaded points in history.
37
+
38
+ ``` bash
39
+ git clone --filter=' blob:none' https://github.com/rust-lang/rust.git
40
+ cd rust
41
+ ```
42
+
43
+ > ** NOTE** : [ This link] ( https://github.blog/open-source/git/get-up-to-speed-with-partial-clone-and-shallow-clone/ )
44
+ > describes this type of checkout in more detail, and also compares it to other modes, such as
45
+ > shallow cloning.
46
+
28
47
### Shallow clone the repository
29
48
30
- Due to the size of the repository, cloning on a slower internet connection can take a long time .
31
- To sidestep this , you can use the ` --depth N ` option with the ` git clone ` command.
49
+ An older alternative to partial clones is to use shallow clone the repository instead .
50
+ To do so , you can use the ` --depth N ` option with the ` git clone ` command.
32
51
This instructs ` git ` to perform a "shallow clone", cloning the repository but truncating it to
33
52
the last ` N ` commits.
34
53
@@ -43,8 +62,9 @@ cd rust
43
62
44
63
> ** NOTE** : A shallow clone limits which ` git ` commands can be run.
45
64
> If you intend to work on and contribute to the compiler, it is
46
- > generally recommended to fully clone the repository [ as shown above] ( #get-the-source-code ) .
47
- >
65
+ > generally recommended to fully clone the repository [ as shown above] ( #get-the-source-code ) ,
66
+ > or to perform a [ partial clone] ( #shallow-clone-the-repository ) instead.
67
+ >
48
68
> For example, ` git bisect ` and ` git blame ` require access to the commit history,
49
69
> so they don't work if the repository was cloned with ` --depth 1 ` .
50
70
0 commit comments