Is a Shallow Clone?

Is a Shallow Clone?

A shallow clone is a repository created by limiting the depth of the history that is cloned from an original repository. The depth of the cloned repository, which is selected when the cloning operation is performed, is defined as the number of total commits that the linear history of the repository will contain.

What is shallow clone depth?

"Clone depth" is a feature of git to reduce server load: Instead of cloning the complete repository (as usually done with git), using clone depth just clones the last clone-depth-number revisions of your repository. In literature this is also called "shallow clone"

How do I shallow clone git?

Shallow git clone steps
  1. Obtain the http url of the repository to clone.
  2. Include the –depth 5 option in the git clone command.
  3. Run the git clone command in the BASH shell.
  4. Switch into the directory created by the shallow git clone.
  5. Perform a git log –oneline operation to verify the clone depth.
Marcus Vance
Author

Marcus Vance

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.