Git Clone

Git Clone

git clone command clones a remote directory from online (GitHub) and creates a new directory in your machine .this command doesn’t clone the complete repo, development branches within refs***/heads*/ are not permitted to be cloned.anyone can clone any public repositories .we can use git clone once again, if it already exists in our machine, this time it fetches changes in the repository.

Clone a repository

git clone <repository url>

example

git clone https://github.com/grafov/hulk.git

when remote repositories are cloned using default command clone, the master branch of the origin remote will be clone origin/master

Clone a branch

git clone <repository url> -b <branch name>

example

git clone https://github.com/jenkinsci/jenkins/ -b windows-ci

Clone a repo to the new directory

git clone <repository url> <dirname>

Create a shallow clone with last 15 commits

git clone --depth 15 <repository url>
Last updated on by vishal devxo