Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Git Version Control Cookbook

You're reading from   Git Version Control Cookbook 90 hands-on recipes that will increase your productivity when using Git as a version control system

Arrow left icon
Product type Paperback
Published in Jul 2014
Publisher
ISBN-13 9781782168454
Length 340 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Table of Contents (14) Chapters Close

Preface 1. Navigating Git 2. Configuration FREE CHAPTER 3. Branching, Merging, and Options 4. Rebase Regularly and Interactively, and Other Use Cases 5. Storing Additional Information in Your Repository 6. Extracting Data from the Repository 7. Enhancing Your Daily Work with Git Hooks, Aliases, and Scripts 8. Recovering from Mistakes 9. Repository Maintenance 10. Patching and Offline Sharing 11. Git Plumbing and Attributes 12. Tips and Tricks Index

Introduction

In this chapter, we will take a look at Git's data model. We will learn how Git references its objects and how the history is recorded. We will learn how to navigate the history, from finding certain text snippets in commit messages to the introduction of a certain string in the code.

The data model of Git is different from other common version control systems (VCSs) in the way Git handles its data. Traditionally, a VCS will store its data as an initial file followed by a list of patches for each new version of the file.

Introduction

Git is different; instead of the regular file and patches list, Git records a snapshot of all the files tracked by Git and their paths relative to the repository root, that is, the files tracked by Git in the file system tree. Each commit in Git records the full tree state. If a file does not change between commits, Git will not store the file once more; instead, Git stores a link to the file.

Introduction

This is what makes Git different from most other VCSs, and in the following chapters, we will explore some of the benefits of this powerful model.

The way Git references the files and directories it tracks is directly built into the data model. In short, the Git data model can be summarized as shown in the following diagram:

Introduction

The commit object points to the root tree. The root tree points to subtrees and files. Branches and tags point to a commit object and the HEAD object points to the branch that is currently checked out. So for every commit, the full tree state and snapshot are identified by the root tree.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime