Git - Clone


git clone creates a clone known as local repository from a remote repository.

cloning in git means:

The command is “clone” and not “checkout” ( instead of getting just a working copy, Git receives a full copy of nearly all data that the server has.)

After a first clone of a repository, all files will be tracked, and unmodified because they are just checked out and haven’t been edited.

If you just want to download, see the download page


How to clone basic

  • Creates a directory named “directoryWhereIwantMyCheckoutData” (The default name is the name of the git file in the URL)
  • Get the clone URL from the Web
git clone directoryWhereIwantMyCheckoutData
Cloning into 'directoryWhereIwantMyCheckoutData'...
remote: Counting objects: 77, done.
remote: Total 77 (delta 0), reused 0 (delta 0), pack-reused 77
Unpacking objects: 100% (77/77), done.
Checking connectivity... done.

It will:

  • initializes a git directory inside it,
  • pulls down all the data for that repository,
  • and checks out a working copy of the latest version.

How to clone with only the last commit state?

git clone --depth=1 https://.....git .

How to clone if the directory is not empty

with init and pull

git init
git pull https://.....git "branch"

How to clone and checkout a branch

git clone --branch=stable https://.....git .


Clone an existing Git repository from another server.

git clone [option] [url] [directory]

We can also use the following protocol in place of https:

  • git://
  • ssh with user@server:path/to/repo.git
  • –depth 1 grabs the current file state and no history (handy for a build)

More? See docs/git-clone.html


Git’s clone command automatically:

  • create the origin name,
  • creates a pointer to where its master branch is,
  • names it origin/master locally.
  • create a local master branch starting at the same place as origin’s master branch (where you will work to)

Discover More
Card Puncher Data Processing
Code Shipping - Change and Deployment Pipeline - Development Lifecycle / Workflow

Deployment pipelines describe how a change in your application moves through your infrastructure into production. It lays out all necessary automated and manual steps. Every step that can be automated...

is a content-addressable file system used to track directory tree content (as defined by its creator Linux Torvald) It's not a version control...
Git - Getting Started

An article that takes the basic steps in order to set up a Git repository When you want to set up a repository, you face generally two options: you want to create a fresh install from a Git repository...
Git - Git (executable|command line)

The git executable where: --git-dir is the location of the repository files --work-tree is the location of the work tree Command Description add Add file contents to the index add--interactive...
Git - Upstream Branch (Tracking branch)

An upstream is a configuration of a local branch that set the remote branch that it's tracking. cloning @{u} or @{upstream} means the upstream branch of the current branch @{upstream} or @{u}...
What is the Origin in Git?

origin is the default name for a remote when you run git clone. If you run git clone -o myRemote instead, then you will have myRemote/master as your default remote branch. origin designs then often...

Share this page:
Follow us:
Task Runner