Almost all examples and discussions in this book assume the reader has a Unix-like system with a command-line interface. The author developed these examples on Debian and Ubuntu Linux environments. The examples should work under other environments, such as Mac OS X or Solaris, but the reader can expect slight variations.
A few examples require root access on machines where system operations are needed. Naturally, in such situations you should have a clear understanding of the responsibilities of root access.
Book Layout and Omissions
This book is organized as a progressive series of topics, each designed to build upon concepts introduced earlier. The first 10 chapters focus on concepts and operations that pertain to one repository. They form the foundation for more complex operations on multiple repositories covered in the final six chapters.
If you already have Git installed or have even used it briefly, you may not need the introductory and installation information in the first two chapters, nor even the quick tour presented in the third chapter.
The concepts covered in are essential for a firm grasp on Gits object model. They set the stage and prepare the reader for a clearer understanding of many of Gits more complex operations.
Chapters explains how Git derives and presents diffs.
Git provides a rich and powerful ability to join different branches of development. The basics of branch merging and resolving merge conflicts is covered in . A key insight into Gits model is the realization that all merging performed by Git happens in your local repository in the context of your current working directory.
The fundamentals of naming and exchanging data with another, remote repository are covered in .
to cover patch handling when direct exchange of repository information isnt possible using Gits native transfer protocols.
The remaining three chapters cover advanced topics: the use of hooks, combining projects and multiple repositories into a superproject, and interacting with Subversion repositories.
Git is still evolving rapidly because there is an active developer base. It is not that Git isnt mature enough to be used for development; rather, ongoing refinements and user interface issues are being enhanced regularly. Even as this book was being written, Git evolved. Apologies if I was unable to keep up accurately.
I do not give the command gitk the complete coverage that it deserves. If you like graphical representations of the history within a repository, you should explore gitk . Other history visualization tools exist as well, but they are not covered here either. Nor am I able to cover a rapidly evolving and growing host of other Git-related tools. Im not even able to cover all of Gits own core commands and options thoroughly in this book. Again, my apologies.
Perhaps, though, enough pointers, tips, and direction can be found here to inspire readers to do some of their own research and exploration!
Conventions Used in This Book
The following typographical conventions are used in this book:
ItalicIndicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values determined by context.
Tip
This icon signifies a tip, suggestion, useful hint, or a general note.
Warning
This icon indicates a warning or caution.
Furthermore, you should be familiar with basic shell commands to manipulate files and directories. Many examples will contain commands such as these to add or remove directories, copy files, or create simple files:
$
cp file.txt copy-of-file.txt
$
mkdir newdirectory
$
rm file
$
rmdir somedir
$
echo "Test line" > file
$
echo "Another line" >> file
Commands that need to be executed with root permissions appear with a sudo operation :
# Install the Git core package$
sudo apt-get install git-core
How you edit files or effect changes within your working directory is pretty much up to you. You should be familiar with a text editor. In this book, Ill denote the process of editing a file by either a direct comment or a pseudocommand:
# edit file.c to have some new text$
edit index.html
Using Code Examples
This book is here to help you get your job done. In general, you may use the code in this book in your programs and documentation. You do not need to contact us for permission unless youre reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from OReilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your products documentation does require permission.
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: Version Control with Git, by Jon Loeliger. Copyright 2009 Jon Loeliger, 978-0-596-52012-0.
If you feel your use of code examples falls outside fair use or the permission given above, feel free to contact us at .