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 11 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 10 chapters.
If you already have Git installed or have even used it briefly, then 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 are covered in expose some operations for altering, storing, tracking, and recovering daily development within your development repository.
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 next four chapters cover advanced topics of interest: the use of hooks ().
Chapters provide some advanced examples and clever tips, tricks, and techniques that may help transform you into a true Git guru.
Finally, introduces GitHub and explains how Git has enabled a creative, social development process around version control.
Git is still evolving rapidly because there is an active developer base. Its not that Git is so immature that you cannot use it 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 useful hint or a tip.
Warning
This icon indicates a warning or caution.
Note
This icon indicates a general note.
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 as 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 and Matthew McCullough. Copyright 2012 Jon Loeliger, 978-1-449-31638-9.
If you feel your use of code examples falls outside fair use or the permission given previously, feel free to contact us at .
Safari Books Online
Note
Safari Books Online (www.safaribooksonline.com) is an on-demand digital library that delivers expert content in both book and video form from the worlds leading authors in technology and business.
Technology professionals, software developers, web designers, and business and creative professionals use Safari Books Online as their primary resource for research, problem solving, learning, and certification training.
Safari Books Online offers a range of product mixes and pricing programs for organizations, government agencies, and individuals. Subscribers have access to thousands of books, training videos, and prepublication manuscripts in one fully searchable database from publishers like OReilly Media, Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que, Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kaufmann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders, McGraw-Hill, Jones & Bartlett, Course Technology, and dozens more. For more information about Safari Books Online, please visit us online.