Remote Repository Operations in Pictures

Let’s take a moment to visualize what happens during clone and pull operations. A few pictures should also clarify the often confusing uses of the same name in different contexts.

Let’s start with the simple repository shown in Figure 11-1 as the basis for discussion.

Simple repository with commits

Figure 11-1. Simple repository with commits

As with all of our commit graphs, the sequence of commits flows from left to right and the master label points to the HEAD of the branch. The two most recent commits are labeled A and B. Let’s follow these two commits, introduce a few more, and watch what occurs.

Cloning a Repository

A git clone command yields two separate repositories, as shown in Figure 11-2.

Cloned repository

Figure 11-2. Cloned repository

This picture illustrates some important results of the clone operation:

  • All the commits from the original repository are copied to your clone; you could now easily retrieve earlier stages of the project from your own repository.

  • The development branch named master from the original repository is introduced into your clone on a new tracking branch named origin/master.

  • Within the new clone repository, the new origin/master branch is initialized to point to the master HEAD commit, which is B in the figure.

  • A new development branch called master is created in your ...

Get Version Control with Git now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.