[[ch10-git-internals]]
== Git Internals

You may have skipped to this chapter from a much earlier chapter, or you may have gotten here after sequentially reading the entire book up to this point -- in either case, this is where we'll go over the inner workings and implementation of Git.
We found that understanding this information was fundamentally important to appreciating how useful and powerful Git is, but others have argued to us that it can be confusing and unnecessarily complex for beginners.
Thus, we've made this discussion the last chapter in the book so you could read it early or later in your learning process.
We leave it up to you to decide.

Now that you're here, let's get started.
First, if it isn't yet clear, Git is fundamentally a content-addressable filesystem with a VCS user interface written on top of it.
You'll learn more about what this means in a bit.

In the early days of Git (mostly pre 1.5), the user interface was much more complex because it emphasized this filesystem rather than a polished VCS.
In the last few years, the UI has been refined until it's as clean and easy to use as any system out there; however, the stereotype lingers about the early Git UI that was complex and difficult to learn.

The content-addressable filesystem layer is amazingly cool, so we'll cover that first in this chapter; then, you'll learn about the transport mechanisms and the repository maintenance tasks that you may eventually have to deal with.

include::book/10-git-internals/sections/plumbing-porcelain.asc[]

include::book/10-git-internals/sections/objects.asc[]

include::book/10-git-internals/sections/refs.asc[]

include::book/10-git-internals/sections/packfiles.asc[]

include::book/10-git-internals/sections/refspec.asc[]

include::book/10-git-internals/sections/transfer-protocols.asc[]

include::book/10-git-internals/sections/maintenance.asc[]

include::book/10-git-internals/sections/environment.asc[]

=== Summary

At this point, you should have a pretty good understanding of what Git does in the background and, to some degree, how it's implemented.
This chapter has covered a number of plumbing commands -- commands that are lower level and simpler than the porcelain commands you've learned about in the rest of the book.
Understanding how Git works at a lower level should make it easier to understand why it's doing what it's doing and also to write your own tools and helper scripts to make your specific workflow work for you.

Git as a content-addressable filesystem is a very powerful tool that you can easily use as more than just a VCS.
We hope you can use your newfound knowledge of Git internals to implement your own cool application of this technology and feel more comfortable using Git in more advanced ways.
