要理解 Git 是如何工作的,我需要阅读哪些内容?

我想从架构师的角度来理解 Git 的工作方式。如何存储文件、如何保存版本以及如何发生更改(分支、合并等) ?

我不是在寻找如何使用它的信息。(我已经找到了很多含有教程的页面。)但是我没有找到任何“幕后”的细节,这会让我明白。

41058 次浏览

The git source code. :-)

I found this site when I googled "git architecture": http://speirs.org/2007/07/19/a-subversion-user-looks-at-git

Git has a mailing list: "majordomo@vger.kernel.org&body=subscribe%20git" (http://git.or.cz/#community)

And this wikipedia article may be helpful: http://en.wikipedia.org/wiki/Git_(software)

Wikipedia might get you started.

I do remember encountering some documents describing some of the internal architecture, so I know that they are out there. I just can't remember where they were...

I've found the Git User Manual to be very enlightening.

There's a good Google tech talk: Linus Torvalds on git

OK, it's not something to read but it does cover some of the Git internals and design philosophy.

This talk by Randal Schwartz gave me a pretty good overview.

One day I actually sat down and read the entire Git User's Manual. Turned out to be a good idea -- the manual is very helpful, explains a lot, and is quite clear and provides useful examples.

The US$9 100+ page PDF book from PeepCode called Git Internals is fantastic. It's well written, uses great, clear visuals and is also a quick read. I absorbed as much free online material as I could but this book put me over the top.

There are some interesting documents on the Documentation/technical directory of the git source code.

For me, the following three resources were very, very helpful, in this order:

  1. The Thing About Git explained why I should even care

  2. Git Magic explained how to get started

  3. Git The Basics [pdf] explained - graphically, and in detail - what happens when I add, remove, merge, etc.

The Git Internals ebook has already been mentioned. I will point out that its author, Scott Chacon, gave a fantastic presentation about git at RailsConf 2008 that covers much the same ground as the book.

Said Scott now maintains http://git-scm.com/, which includes the Git community book, which is more of a usage tutorial than a technical description, but does include both a nice conceptual overview of the git data model in the introductory chapter and a detailed one in its closing chapter.

To understand how git works you need to read Pro Git book, fully available online for free.

Written by Scott Chacon, one of the guys behind GitHub.

I wrote my opinion about the book in a review at Amazon.

Assume we are living in a pre git era. And you want to write a version control system which is fast and better than the existing vcs. All you need is a great idea. At that moment of time the below article would be of much help.

http://tom.preston-werner.com/2009/05/19/the-git-parable.html