Chapter 12. Collaborating with remotes

 

This is the second chapter (of four) on Git collaboration. In chapter 11, you learned about cloning. In this one, you’ll learn about remotes and the command that manipulates them, git remote. Each clone that you create contains a reference to where it came from. This reference is a remote. Remotes serve as pointers back to a location, either on your computer or on the Internet. It’s the basis for collaboration, along with cloning.

You’ll learn how git remote allows you to examine and update the remote. You’ll also learn about the git ls-remote command, which lets you know if your local repository and your original (remote) repository are out of sync. This chapter will help you understand Git’s collaboration model, and will make the next two chapters on git push and git pull clearer.

12.1. Remotes are distant places

In figure 12.1, you have three repositories: math.clone, math.bob, and math.carol. All of these repositories are created from the math.git repository, which is a bare directory.

Figure 12.1. A small collection of repositories

In your collection of repositories, each clone in the second row (math.clone, math.bob, and math.carol) is created by git clone, using math.git as the source. Each clone contains a reference to math.git. This reference, called a remote, indicates the location of the original repository.

12.2. Interrogating a remote

12.3. Getting a clone from somewhere remote

12.4. Lab

12.5. Further exploration

12.6. Commands in this chapter

sitemap