Chapter 2. Foundational Concepts

In the previous chapter, you learned the foundations of Git, its characteristics, and typical applications of version control. It probably sparked your curiosity and left you with a good number of questions. For instance, how does Git keep track of revisions of the same file at every commit on your local development machine? What are the contents of the hidden .git directory, and what is their significance? How is a commit ID generated, why does it look like gibberish, and should you take note of it?

If you have used another version control system, such as SVN or CVS, you may notice that some of the commands described in the preceding chapter seemed familiar. Although Git serves the same function and provides all the operations you expect from a modern version control system, an exception to this notion is that the inner workings and principles of Git differ in some fundamental and surprising ways.

In this chapter, we explore why and how Git differs by examining the key components of its architecture and some important concepts. We will focus on the basics, common terminology, and the relationship between Git objects and how they are utilized, all through the lens of a single repository. The fundamentals you’ll learn in this chapter also apply when you’re working with multiple interconnected repositories.

Repositories

A Git repository is simply a key–value pair database containing all the information needed to retain and manage the revisions ...

Get Version Control with Git, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.