git shallow clone code example

Example 1: git clone

#You will be required to sign into github

git clone git@github.com:UserName/gitRepositories.git

Example 2: shallow clone

How to Execute Git Shallow Clone
Provide an argument of -- depth 1 to the git clone command to copy only the latest revision of a repo:

git clone -–depth [depth] [remote-url]
 

You can also use git shallow clone to access a single branch:

git clone [remote-url] --branch [name] --single-branch [folder]
 

With git shallow clone you get fewer files. And as a result, they clone faster. Builds and feedback can be delivered quicker.

Example 3: git checkout fast

git clone [remote-url] --branch [name] --single-branch [folder]