Source code control and beyond by Scott Chacon
Git Internals ©2008 Scott Chacon Every effort was made to provide accurate information in this document. However, neither Scott Chacon nor Topfunky Corporation shall have any liability for any errors in the code or descriptions presented in this book. This document is available for US$9 at PeepCode.com (http://peepcode.com). Groupdiscounts and site licenses can also be purchased by sending email to firstname.lastname@example.org.
other peepcode products
contents 4 5 5 6 7 8 10 11 About this book
54 Setting Up Your Profile 55 Getting a Git Repository 57 Normal Workflow Examples 63 Log – the Commit History 65 Browsing Git 71 Searching Git 72 Git Diff 75 Branching 77 Simple Merging 80 Rebasing 86 Stashing 89 Tagging 91 Exporting Git 92 The Care and Feeding of Git 94 DistributedWorkflow Examples 105 Sharing Repositories 107 Hosted Repositories
111 Basic Git 115 Inspecting Repositories 117 Extra Tools 119
Installing on Linux Installing on Mac Windows A Short History of Git
References and Endnotes
119 Web Documentation 120 Screencasts
10 What is Git? Focus and Design 13 Git Object Types 22 The Git Data Model 28 Branching andMerging 41 The Treeish 44 The Git Directory 48 Working Directory 49 The Index 49 Non-SCM Uses of Git
About this book
It took me a pretty long time to really get Git. As I’ve continued to use Git more and more where I work, I’ve found myself trying to teach people what it is and why we use it over and over again, and the reality is that Git generally has a pretty steep learning curve compared tomany other systems. I’ve seen case after case of developers who love Git after they finally understand it, but getting to that point is often somewhat painstaking. This book is aimed at the developer who does not particularly like Subversion, Perforce or whatever SCM system they are currently using, has heard good things about Git, but doesn’t know where to start or why it’s so wonderful. It ismeant to explain Git as simply as possible in a clean, concise, easily readable volume. My goal is to help you understand Git internals as well as usage at a fundamental level by the time you finish this book. To accomplish this, I’m starting the book out (after the introduction) with a section about what Git actually does, rather than how to use it. I found that I didn’t really understand Git andhad many problems using it until I understood what it was actually doing at a low level, rather than thinking of it as a different, weird SVN-like system.
Before we can start playing with Git, we’ll have to install it. I’ll quickly cover installing Git on Linux, Mac and Windows. I will not get into really fine detail, because others have done that much better,but I will give you an overview and links as to where to find more detailed instructions on each platform. For any of these examples, you can find a link to the most current Git source code at git.or.cz (http://git.or.cz). I would recommend compiling from source if possible, simply because Git is lately making big strides in usability, so more current versions may be a bit easier to use....