Requirements: Using git's clone command, the source code and change history of the project will be cloned to the local disk by default, if the project file is updated and iterated frequently, we will download a lot of history, if we just want to consult and learn the latest source code, we only need to download the latest code on demand.
Clone an entire repository is a standard operating procedure using Git. Each clone typically includes everything in the repository. This means that when cloning, you get not only the file, but also every revision of every file that has ever been committed, as well as the history of each commit. And if you have a lot of assets in your codebase, it will contain a long history. The main problem is that this creates bottlenecks in the continuous integration (CI) pipeline. Check out the optimization projects of the codebase such as github.com, often need to complete the cloning of the code, the more star-studded the project, the larger the amount of code, the longer the history, in the case of poor domestic network, often download a few GB after downloading, the network is disconnected. Once interrupted, it cannot be continued, and it has to start from scratch, which is miserable.
Git shallow clone
We only clone the latest commit record with the following command:
-- depthRepresents the depth of the clone,-- depth 1 means that it only clones the latest commit record and the latest content after this commit, and does not clone the history commit, which has the effect of not being able to view the historical commit record, but the cloning speed is greatly improved.
Clone the latest source code + history as follows:
Clone only the latest source code, as follows:
(End)
|