Git clone

From NovaOrdis Knowledge Base
Jump to: navigation, search



git clone executes a repository cloning operation. The mechanics of the clone operation is described below.

Clone Mechanics

This section refers to creation of development repositories, which come into existence as result of a cloning operation. The alternative is to create a bare repository.

The local branches of the original repository, which are usually stored within .git/refs/heads directory of the original repository, become tracking branches in the newly created repository. The tracking branches are stored under .git/refs/remotes/<remote-name> and they maintain the original names. In particular, the original repository's master branch becomes a tracking branch named .git/refs/remotes/<remote-name>/master. Within the clone repository, the new origin/master branch is initialized to point to the local master's HEAD.

Remote tracking branches existent in the original repository at the time of the clone operation are not cloned - so the clone does not know what, if anything, the original is tracking.

Tags from the original repository are copied.

All objects that are reachable from the copied refs are copied. Since parents of commits are reachable from commits, the whole history is available in the cloned repository.

This command creates the working tree which is initially positioned on the master branch.

The following objects are not copied:

  • hooks
  • configuration files
  • the reflog
  • the stash



Changes the default name of the origin ("origin") of a cloned repository.



GitHub git clone

git clone