Skip to content

Commit 86f1d29

Browse files
authored
README: Document monorepo downloading & shallow cloning (#19485)
1 parent 0c675ce commit 86f1d29

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,33 @@ Some exceptions to this rule exist for cases in which we absolutely must deploy
145145
If you're changing or adding a contract and you're unsure about which branch to make a PR into, default to using a feature branch.
146146
Feature branches are typically used when there are conflicts between 2 projects touching the same code, to avoid conflicts from merging both into `develop`.
147147

148+
## Downloading & Shallow-Cloning the Monorepo
149+
150+
If you want to use the monorepo as a dependency, e.g. in CI, you can greatly speed up the fetching process by either downloading it directly as an archive from Github instead of cloning as a git repository or shallow-cloning it.
151+
This avoids downloading the full monorepo git history, which is unfortunately a few GBs in size, but which also isn't needed for many use cases, like CI.
152+
153+
To fetch the monorepo at a specific commit/branch/tag `$REF`, download and unpack with
154+
```
155+
curl -L https://github.com/ethereum-optimism/optimism/archive/$REF.tar.gz | tar xz
156+
```
157+
Note that if you need any of its submodules, you'd need to manually download those too.
158+
159+
If you want a shallow git clone of latest `develop`, you can just do
160+
```
161+
git clone --depth 1 --shallow-submodules https://github.com/ethereum-optimism/optimism.git
162+
```
163+
which takes only a few seconds on a good internet connection.
164+
165+
If you want to shallow-checkout a specific branch or tag `$REF`, do
166+
167+
```
168+
git clone --no-checkout --depth 1 --shallow-submodules https://github.com/ethereum-optimism/optimism.git
169+
cd optimism
170+
git fetch --depth 1 origin "$REF"
171+
git checkout "$REF"
172+
```
173+
which should also only take a few seconds.
174+
148175
## License
149176

150177
All other files within this repository are licensed under the [MIT License](https://github.com/ethereum-optimism/optimism/blob/master/LICENSE) unless stated otherwise.

0 commit comments

Comments
 (0)