This article covers how to use the command 'Git Clone'
If you want to download existing code from a remote repository (like GitHub, or Bitbucket), then git clone is the way to do it.
The command essentially creates a copy of the latest version of the repository and saves it to your computer.
The simplest form of the command is
git clone <repository-url> <local-directory>
For instance:
git clone https://repo-link-goes-here.git C:\Code
If you're using GitHub, you can find the URL easily under the code button on the far right. For this blog, here's what I see:
This will clone the git repository into C:\Code
If you want to clone a specific branch, you can use:
git clone --branch <branchname> <repositoryUrl>
Or, for shorthand
git clone -b <branchname> <repositoryUrl>
You can also retrieve a shallow clone, specifying the depth:
git clone -depth =1 <repositoryUrl>
Here, we only clone the history of commits specified by the option depth=1, which means only the most recent commit is included in our newly cloned repository.
You may want to use this feature when you have a large repository with an extensive commit history, but only need the latest change.