100% found this document useful (1 vote)
4 views

Version Control with Git 2nd Edition Jon Loeliger pdf download

Version Control with Git, 2nd Edition by Jon Loeliger and Matthew McCullough provides comprehensive guidance on using Git for version control. The book covers installation, basic concepts, file management, commits, branches, merges, and remote repositories, making it suitable for both beginners and experienced users. Published by O'Reilly Media in 2012, it serves as a valuable resource for understanding and utilizing Git effectively.

Uploaded by

pppwotgaf265
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
4 views

Version Control with Git 2nd Edition Jon Loeliger pdf download

Version Control with Git, 2nd Edition by Jon Loeliger and Matthew McCullough provides comprehensive guidance on using Git for version control. The book covers installation, basic concepts, file management, commits, branches, merges, and remote repositories, making it suitable for both beginners and experienced users. Published by O'Reilly Media in 2012, it serves as a valuable resource for understanding and utilizing Git effectively.

Uploaded by

pppwotgaf265
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

Version Control with Git 2nd Edition Jon Loeliger

download pdf

https://ebookultra.com/download/version-control-with-git-2nd-edition-
jon-loeliger/

Visit ebookultra.com today to download the complete set of


ebook or textbook!
We have selected some products that you may be interested in
Click the link to download now or visit ebookultra.com
for more options!.

Pro Git 2nd Edition Scott Chacon

https://ebookultra.com/download/pro-git-2nd-edition-scott-chacon/

Vibration with Control 2nd Edition Daniel J. Inman

https://ebookultra.com/download/vibration-with-control-2nd-edition-
daniel-j-inman/

Coping With Trauma Hope Through Understanding 2nd Edition


Jon G. Allen

https://ebookultra.com/download/coping-with-trauma-hope-through-
understanding-2nd-edition-jon-g-allen/

Classical Feedback Control With MATLAB and Simulink 2nd


Edition Lurie

https://ebookultra.com/download/classical-feedback-control-with-
matlab-and-simulink-2nd-edition-lurie/
Professional Git 1st Edition Brent Laster

https://ebookultra.com/download/professional-git-1st-edition-brent-
laster/

AIDS Inc 2nd Edition Jon Rappoport

https://ebookultra.com/download/aids-inc-2nd-edition-jon-rappoport/

Professional Baking College Version with CD Rom 4th


Edition Wayne Gisslen

https://ebookultra.com/download/professional-baking-college-version-
with-cd-rom-4th-edition-wayne-gisslen/

Teaching with Love Logic Taking Control of the Classroom


2nd Edition Jim Fay

https://ebookultra.com/download/teaching-with-love-logic-taking-
control-of-the-classroom-2nd-edition-jim-fay/

Control and Constraint in E learning Choosing When to


Choose 1st Edition Jon Dron

https://ebookultra.com/download/control-and-constraint-in-e-learning-
choosing-when-to-choose-1st-edition-jon-dron/
Version Control with Git 2nd Edition Jon Loeliger Digital
Instant Download
Author(s): Jon Loeliger, Matthew McCullough
ISBN(s): 9781449316389, 1449316387
Edition: 2
File Details: PDF, 14.54 MB
Year: 2012
Language: english
SECOND EDITION

Version Control with Git


Download from Wow! eBook <www.wowebook.com>

Jon Loeliger and Matthew McCullough

Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo


Version Control with Git, Second Edition
by Jon Loeliger and Matthew McCullough

Copyright © 2012 Jon Loeliger. All rights reserved.


Printed in the United States of America.

Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.

O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions
are also available for most titles (http://my.safaribooksonline.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or [email protected].

Editor: Andy Oram Indexer: Nancy Guenther on behalf of Potomac


Production Editor: Iris Febres Indexing, LLC
Copyeditor: Absolute Service, Inc. Cover Designer: Karen Montgomery
Proofreader: Absolute Service, Inc. Interior Designer: David Futato
Illustrators: Robert Romano and Rebecca Demarest

May 2009: First Edition.


August 2012: Second Edition.

Revision History for the Second Edition:


2012-08-03 First release
See http://oreilly.com/catalog/errata.csp?isbn=9781449316389 for release details.

Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of
O’Reilly Media, Inc. Version Control with Git, the image of the image of a long-eared bat, and related
trade dress are trademarks of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a
trademark claim, the designations have been printed in caps or initial caps.

While every precaution has been taken in the preparation of this book, the publisher and authors assume
no responsibility for errors or omissions, or for damages resulting from the use of the information con-
tained herein.

ISBN: 978-1-449-31638-9

[LSI]

1344953139
Table of Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Background 1
The Birth of Git 2
Precedents 4
Timeline 6
What’s in a Name? 7

2. Installing Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Using Linux Binary Distributions 9
Debian/Ubuntu 9
Other Binary Distributions 10
Obtaining a Source Release 11
Building and Installing 12
Installing Git on Windows 13
Installing the Cygwin Git Package 14
Installing Standalone Git (msysGit) 15

3. Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
The Git Command Line 19
Quick Introduction to Using Git 21
Creating an Initial Repository 21
Adding a File to Your Repository 22
Configuring the Commit Author 24
Making Another Commit 24
Viewing Your Commits 25
Viewing Commit Differences 26
Removing and Renaming Files in Your Repository 26
Making a Copy of Your Repository 27
Configuration Files 28

iii
Configuring an Alias 30
Inquiry 30

4. Basic Git Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31


Basic Concepts 31
Repositories 31
Git Object Types 32
Index 33
Content-Addressable Names 33
Git Tracks Content 34
Pathname Versus Content 35
Pack Files 36
Object Store Pictures 36
Git Concepts at Work 39
Inside the .git Directory 39
Objects, Hashes, and Blobs 40
Files and Trees 41
A Note on Git’s Use of SHA1 42
Tree Hierarchies 43
Commits 44
Tags 46

5. File Management and the Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47


It’s All About the Index 48
File Classifications in Git 48
Using git add 50
Some Notes on Using git commit 52
Using git commit --all 52
Writing Commit Log Messages 54
Using git rm 54
Using git mv 56
A Note on Tracking Renames 57
The .gitignore File 58
A Detailed View of Git’s Object Model and Files 60

6. Commits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Atomic Changesets 66
Identifying Commits 67
Absolute Commit Names 67
refs and symrefs 68
Relative Commit Names 69
Commit History 72
Viewing Old Commits 72

iv | Table of Contents
Commit Graphs 74
Commit Ranges 78
Finding Commits 83
Using git bisect 83
Using git blame 87
Using Pickaxe 88

7. Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Reasons for Using Branches 89
Branch Names 90
Dos and Don’ts in Branch Names 91
Using Branches 91
Creating Branches 93
Listing Branch Names 94
Viewing Branches 94
Checking out Branches 97
A Basic Example of Checking out a Branch 97
Checking out When You Have Uncommitted Changes 98
Merging Changes into a Different Branch 99
Creating and Checking out a New Branch 101
Detached HEAD Branches 102
Deleting Branches 103

8. Diffs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Forms of the git diff Command 108
Simple git diff Example 112
git diff and Commit Ranges 115
git diff with Path Limiting 117
Comparing How Subversion and Git Derive diffs 119

9. Merges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Merge Examples 121
Preparing for a Merge 122
Merging Two Branches 122
A Merge with a Conflict 124
Working with Merge Conflicts 128
Locating Conflicted Files 129
Inspecting Conflicts 129
How Git Keeps Track of Conflicts 134
Finishing Up a Conflict Resolution 135
Aborting or Restarting a Merge 137
Merge Strategies 137
Degenerate Merges 140

Table of Contents | v
Normal Merges 142
Specialty Merges 143
Applying Merge Strategies 144
Merge Drivers 145
How Git Thinks About Merges 146
Merges and Git’s Object Model 146
Squash Merges 147
Why Not Just Merge Each Change One by One? 148

10. Altering Commits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151


Caution About Altering History 152
Using git reset 154
Using git cherry-pick 161
Using git revert 163
reset, revert, and checkout 164
Changing the Top Commit 165
Rebasing Commits 167
Using git rebase -i 170
rebase Versus merge 174

11. The Stash and the Reflog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181


The Stash 181
The Reflog 189

12. Remote Repositories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195


Repository Concepts 196
Bare and Development Repositories 196
Repository Clones 197
Remotes 198
Tracking Branches 199
Referencing Other Repositories 200
Referring to Remote Repositories 200
The refspec 202
Example Using Remote Repositories 204
Creating an Authoritative Repository 205
Make Your Own Origin Remote 206
Developing in Your Repository 208
Pushing Your Changes 209
Adding a New Developer 210
Getting Repository Updates 212
Remote Repository Development Cycle in Pictures 217
Cloning a Repository 217
Alternate Histories 218

vi | Table of Contents
Non–Fast-Forward Pushes 219
Fetching the Alternate History 221
Merging Histories 222
Merge Conflicts 223
Pushing a Merged History 223
Remote Configuration 223
Using git remote 224
Using git config 225
Using Manual Editing 226
Working with Tracking Branches 227
Creating Tracking Branches 227
Ahead and Behind 230
Adding and Deleting Remote Branches 231
Bare Repositories and git push 232

13. Repository Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235


A Word About Servers 235
Publishing Repositories 236
Repositories with Controlled Access 236
Repositories with Anonymous Read Access 238
Repositories with Anonymous Write Access 242
Publishing Your Repository to GitHub 242
Repository Publishing Advice 243
Repository Structure 244
The Shared Repository Structure 244
Distributed Repository Structure 244
Repository Structure Examples 246
Living with Distributed Development 248
Changing Public History 248
Separate Commit and Publish Steps 249
No One True History 249
Knowing Your Place 250
Upstream and Downstream Flows 251
The Maintainer and Developer Roles 251
Maintainer–Developer Interaction 252
Role Duality 253
Working with Multiple Repositories 254
Your Own Workspace 254
Where to Start Your Repository 255
Converting to a Different Upstream Repository 256
Using Multiple Upstream Repositories 257
Forking Projects 259

Table of Contents | vii


14. Patches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Why Use Patches? 264
Generating Patches 265
Patches and Topological Sorts 272
Mailing Patches 273
Applying Patches 276
Bad Patches 283
Patching Versus Merging 283

15. Hooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285


Installing Hooks 287
Example Hooks 287
Creating Your First Hook 288
Available Hooks 290
Commit-Related Hooks 290
Patch-Related Hooks 291
Push-Related Hooks 292
Other Local Repository Hooks 294

16. Combining Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295


The Old Solution: Partial Checkouts 296
The Obvious Solution: Import the Code into Your Project 297
Importing Subprojects by Copying 299
Importing Subprojects with git pull -s subtree 299
Submitting Your Changes Upstream 303
The Automated Solution: Checking out Subprojects Using Custom Scripts 304
The Native Solution: gitlinks and git submodule 305
Gitlinks 306
The git submodule Command 308

17. Submodule Best Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313


Submodule Commands 314
Why Submodules? 315
Submodules Preparation 315
Why Read Only? 316
Why Not Read Only? 317
Examining the Hashes of Submodule Commits 317
Credential Reuse 318
Use Cases 318
Multilevel Nesting of Repos 319
Submodules on the Horizon 320

viii | Table of Contents


18. Using Git with Subversion Repositories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
Example: A Shallow Clone of a Single Branch 321
Making Your Changes in Git 324
Fetching Before Committing 325
Committing Through git svn rebase 326
Pushing, Pulling, Branching, and Merging with git svn 327
Keeping Your Commit IDs Straight 328
Cloning All the Branches 329
Sharing Your Repository 331
Merging Back into Subversion 332
Miscellaneous Notes on Working with Subversion 334
svn:ignore Versus .gitignore 334
Reconstructing the git-svn Cache 334

19. Advanced Manipulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337


Using git filter-branch 337
Examples Using git filter-branch 339
filter-branch Pitfalls 344
How I Learned to Love git rev-list 345
Date-Based Checkout 345
Retrieve Old Version of a File 348
Interactive Hunk Staging 350
Recovering a Lost Commit 360
The git fsck Command 361
Reconnecting a Lost Commit 365

20. Tips, Tricks, and Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367


Interactive Rebase with a Dirty Working Directory 367
Remove Left-Over Editor Files 368
Garbage Collection 368
Split a Repository 370
Tips for Recovering Commits 371
Subversion Conversion Tips 372
General Advice 372
Remove a Trunk After an SVN Import 372
Removing SVN Commit IDs 373
Manipulating Branches from Two Repositories 374
Recovering from an Upstream Rebase 374
Make Your Own Git Command 376
Quick Overview of Changes 376
Cleaning Up 377
Using git-grep to Search a Repository 378
Updating and Deleting refs 380

Table of Contents | ix
Following Files that Moved 380
Keep, But Don’t Track, This File 381
Have You Been Here Before? 382

21. Git and GitHub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385


Repo for Public Code 385
Creating a GitHub Repository 388
Social Coding on Open Source 390
Watchers 391
News Feed 392
Forks 392
Creating Pull Requests 394
Managing Pull Requests 396
Notifications 398
Finding Users, Projects, and Code 401
Download from Wow! eBook <www.wowebook.com>

Wikis 402
GitHub Pages (Git for Websites) 403
In-Page Code Editor 405
Subversion Bridge 407
Tags Automatically Becoming Archives 408
Organizations 409
REST API 410
Social Coding on Closed Source 411
Eventual Open Sourcing 411
Coding Models 412
GitHub Enterprise 414
GitHub in Sum 416

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417

x | Table of Contents
Preface

Audience
Although some familiarity with revision control systems will be good background
material, a reader who is not familiar with any other system will still be able to learn
enough about basic Git operations to be productive in a short while. More advanced
readers should be able to gain insight into some of Git’s internal design and thus master
some of its more powerful techniques.
The main intended audience of this book should be familiar and comfortable with the
Unix shell, basic shell commands, and general programming concepts.

Assumed Framework
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 responsi-
bilities 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.

xi
The concepts covered in Chapter 4 are essential for a firm grasp on Git’s object model.
They set the stage and prepare the reader for a clearer understanding of many of Git’s
more complex operations.
Chapters 5 through 11 cover various topics in more detail. Chapter 5 describes the
index and file management. Chapters 6 and 10 discuss the fundamentals of making
commits and working with them to form a solid line of development. Chapter 7 intro-
duces branches so that you may manipulate several different lines of development from
your one local repository. Chapter 8 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 Chapter 9. A key
insight into Git’s model is to realize that all merging performed by Git happens in your
local repository in the context of your current working directory. Chapters 10 and 11
expose some operations for altering, storing, tracking, and recovering daily develop-
ment within your development repository.
The fundamentals of naming and exchanging data with another, remote repository are
covered in Chapter 12. Once the basics of merging have been mastered, interacting
with multiple repositories is shown to be a simple combination of an exchange step
plus a merge step. The exchange step is the new concept covered in this chapter and
the merge step is covered in Chapter 9.
Chapter 13 provides a more philosophical and abstract coverage of repository
management “in the large.” It also establishes a context for Chapter 14 to cover patch
handling when direct exchange of repository information isn’t possible using Git’s
native transfer protocols.
The next four chapters cover advanced topics of interest: the use of hooks (Chap-
ter 15), combining projects and multiple repositories into a superproject (Chap-
ter 16), and interacting with Subversion repositories (Chapter 17).
Chapters 19 and 20 provide some advanced examples and clever tips, tricks, and tech-
niques that may help transform you into a true Git guru.
Finally, Chapter 21 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. It’s 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. I’m
not even able to cover all of Git’s own core commands and options thoroughly in this
book. Again, my apologies.

xii | Preface
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:
Italic
Indicates 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 deter-
mined by context.

This icon signifies a useful hint or a tip.

This icon indicates a warning or caution.

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

Preface | xiii
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, I’ll 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 you’re 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 O’Reilly 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 product’s 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 [email protected].

Safari® Books Online


Safari Books Online (www.safaribooksonline.com) is an on-demand digital
library that delivers expert content in both book and video form from the
world’s leading authors in technology and business.
Technology professionals, software developers, web designers, and business and cre-
ative 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 organi-
zations, government agencies, and individuals. Subscribers have access to thousands
of books, training videos, and prepublication manuscripts in one fully searchable
database from publishers like O’Reilly 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

xiv | Preface
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.

How to Contact Us
Please address comments and questions concerning this book to the publisher:
O’Reilly Media, Inc.
1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)
We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at:
http://oreil.ly/VCWG2e
To comment or ask technical questions about this book, send email to:
[email protected]
For more information about our books, courses, conferences, and news, see our website
at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments
This work would not have been possible without the help of many other people. I’d
like to thank Avery Pennarun for contributing substantial material to Chapters 15, 16,
and 18. He also contributed some material to Chapters 4 and 9. His help was appre-
ciated. I’d like to thank Matthew McCullough for the material in Chapters 17 and 21,
assorted suggestions, and general advice. Martin Langhoff is paraphrased with
permission for some repository publishing advice in Chapter 13, and Bart Massey’s tip
on keeping a file without tracking is also used with permission. I’d like to publicly thank
those who took time to review the book at various stages: Robert P. J. Day, Alan Hasty,
Paul Jimenez, Barton Massey, Tom Rix, Jamey Sharp, Sarah Sharp, Larry Streepy, Andy
Wilcox, and Andy Wingo. Robert P. J. Day, thankfully, took the time to review both
editions of the book front to back.
Also, I’d like to thank my wife Rhonda, and daughters Brandi and Heather, who pro-
vided moral support, gentle nudging, Pinot Noir, and the occasional grammar tip. And

Preface | xv
thanks to Mylo, my long-haired dachshund who spent the entire writing process curled
up lovingly in my lap. I’d like to add a special thanks to K. C. Dignan, who supplied
enough moral support and double-stick butt-tape to keep my behind in my chair long
enough to finish this book!
Finally, I would like to thank the staff at O’Reilly as well as my editors, Andy Oram
and Martin Streicher.

Attributions
Linux® is the registered trademark of Linus Torvalds in the United States and other
countries.
PowerPC® is a trademark of International Business Machines Corporation in the
United States, other countries, or both.
UNIX is a registered trademark of The Open Group in the United States and other
countries.

xvi | Preface
CHAPTER 1
Introduction

Background
No cautious, creative person starts a project nowadays without a back-up strategy.
Because data is ephemeral and can be lost easily—through an errant code change or a
catastrophic disk crash, say—it is wise to maintain a living archive of all work.
For text and code projects, the back-up strategy typically includes version control, or
tracking and managing revisions. Each developer can make several revisions per day,
and the ever increasing corpus serves simultaneously as repository, project narrative,
communication medium, and team and product management tool. Given its pivotal
role, version control is most effective when tailored to the working habits and goals of
the project team.
A tool that manages and tracks different versions of software or other content is referred
to generically as a version control system (VCS), a source code manager (SCM), a
revision control system (RCS), and several other permutations of the words “revision,”
“version,” “code,” “content,” “control,” “management,” and “system.” Although the
authors and users of each tool might debate esoterics, each system addresses the same
issue: develop and maintain a repository of content, provide access to historical editions
of each datum, and record all changes in a log. In this book, the term version control
system (VCS) is used to refer generically to any form of revision control system.
This book covers Git, a particularly powerful, flexible, and low-overhead version con-
trol tool that makes collaborative development a pleasure. Git was invented by Linus
Torvalds to support the development of the Linux®1 kernel, but it has since proven
valuable to a wide range of projects.

1. Linux® is the registered trademark of Linus Torvalds in the United States and other countries.

1
The Birth of Git
Often, when there is discord between a tool and a project, the developers simply create
a new tool. Indeed, in the world of software, the temptation to create new tools can be
deceptively easy and inviting. In the face of many existing version control systems, the
decision to create another shouldn’t be made casually. However, given a critical need,
a bit of insight, and a healthy dose of motivation, forging a new tool can be exactly the
right course.
Git, affectionately termed “the information manager from hell” by its creator (Linus is
known for both his irascibility and his dry wit), is such a tool. Although the precise
circumstances and timing of its genesis are shrouded in political wrangling within the
Linux kernel community, there is no doubt that what came from that fire is a well-
engineered version control system capable of supporting the worldwide development
of software on a large scale.
Prior to Git, the Linux kernel was developed using the commercial BitKeeper VCS,
which provided sophisticated operations not available in then-current, free software
VCSs such as RCS and the concurrent version system (CVS). However, when the
company that owned BitKeeper placed additional restrictions on its “free as in beer”
version in the spring of 2005, the Linux community realized that BitKeeper was no
longer a viable solution.
Linus looked for alternatives. Eschewing commercial solutions, he studied the free
software packages but found the same limitations and flaws that led him to reject them
previously. What was wrong with the existing VCSs? What were the elusive missing
features or characteristics that Linus wanted and couldn’t find?
Facilitate Distributed Development
There are many facets to “distributed development,” and Linus wanted a new VCS
that would cover most of them. It had to allow parallel as well as independent and
simultaneous development in private repositories without the need for constant
synchronization with a central repository, which could form a development
bottleneck. It had to allow multiple developers in multiple locations even if some
of them were offline temporarily.
Scale to Handle Thousands of Developers
It isn’t enough just to have a distributed development model. Linus knew that
thousands of developers contribute to each Linux release. So any new VCS had to
handle a very large number of developers whether they were working on the same
or different parts of a common project. And the new VCS had to be able to integrate
all of their work reliably.
Perform Quickly and Efficiently
Linus was determined to ensure that a new VCS was fast and efficient. In order to
support the sheer volume of update operations that would be made on the Linux
kernel alone, he knew that both individual update operations and network transfer

2 | Chapter 1: Introduction
Random documents with unrelated
content Scribd suggests to you:
CHAPTER XIV.

Just at this moment a gentle tap was heard at the door; Lady
Gordon gave her permission to enter; and the opening door
displayed to their astonished eyes, Howard himself.
Yes, there he was, to all appearance perfectly well,—the man
whom they had been mourning over as dead, stood before them in
flesh and blood, with no other difference from his usual air, than that
he looked rather flushed with exercise, and somewhat surprised at
his reception.
"Mr. Howard!" gasped Lady Gordon, scarcely believing her senses.
Emma was speechless with twenty different feelings.
"I fear I am an unwelcome visitor," said he, amazed at his
reception; "shall I withdraw?"
Before either of the ladies could reply, Sir William precipitately
entered the room; he had apparently been in the act of dressing, for
he made his appearance without a coat, and unmindful of where he
was, he rushed up to Howard, and actually embracing him in the
excitement of his joy, exclaimed:
"My dear fellow, twenty millions of welcomes to you, how came
you here—we never thought to see you again!"
Lady Gordon too, had risen, and clasping both his hands in hers,
she exclaimed:
"Oh, how I rejoice to see you alive—you cannot think how we all
grieved when we heard you were dead!"
It was now Howard's turn to look bewildered: he turned from the
husband to the wife in uncontrollable amazement, and said:
"May I ask what is the meaning of all this—are you performing a
comedy or acting a charade!"
"Why I suppose," said Sir William, recovering himself a little, "we
do all seem rather frantic to you, since you must be alike ignorant of
our anxieties and the relief your presence has occasioned. The fact
is, we heard you were dead!"
"Indeed!" exclaimed Howard.
"Take care, or Mr. Howard will begin to believe it too, and that will
frighten him," said Rosa, laughing almost hysterically.
"But do tell me what you thought was the matter with me," said
Howard impatiently.
"We heard you had fallen and been killed amongst the rocks," said
Sir William, "and we were very unhappy about it. I assure you, you
have been wept by bright eyes, and fair cheeks have turned pale at
the news of your death. There is not a man in the whole county has
been more talked of than you; the news of your melancholy death
reached us in the gayest moment of a fête, sent Lady Gordon into
fits, and all the company out of the house, broke up the dance,
interrupted six tender flirtations and three rubbers at whist, in short,
caused more unhappiness, disappointment, and dismay, than an
ordinary individual would reasonably expect to excite either living or
dying."
"Really it is a very uncommon fate for a man to hear the
lamentations occasioned by his death, and if what you say is not
exaggerated, Sir William, I ought to be greatly flattered," replied
Howard smiling, but at the same time looking round the room to see
what was become of the one face, whose expression he was most
anxious to read. But Emma was gone; she had left the room without
a word of congratulatory greeting, or a single expression of interest.
"I cannot think how you can jest about so serious an affair,
William," said his wife reproachfully, "you did not jest, however,
whilst you believed it; he is not quite without feeling, Mr. Howard."
"And did you honor me with tears, Lady Gordon?" said the young
clergyman, taking her hand with an irrepressible feeling of
gratification. "That was a thing almost worth dying for."
"Come, come," said Sir William interposing, "do not be making
love to Rosa before my face; though she did cry, hers were not the
only tears shed on the occasion, nor the most flattering to you."
"Who else wept for me?" enquired he with something more than
curiosity.
"Your old housekeeper, and your gardener's daughter," replied
Lady Gordon maliciously.
"Nobody else?"
"Abominable conceit—who else do you expect to hear of?"
exclaimed she, "I declare all men are alike, if you give the smallest
encouragement to their good opinion of themselves, they set no
bounds to their presumptuous expectations. I shall tell you no more.
Find out for yourself who feels any interest in your fate."
"Miss Carr expressed great sensibility on the occasion," interrupted
Sir William, "I was dancing with her at the time the news arrived,
and she said:
"'Dear me, how very shocking—poor young man.'"
"Thank you," replied Howard with a glow of satisfaction, "you
have told me quite enough to satisfy a much less modest man than I
am. I have heard sufficient. But I think I know how the report arose.
I was left behind at a riding party, as the girth of my saddle broke,
and I stopped at a country shop to get it repaired. I dare say in the
imperfect Welsh which was all we could muster of the country's
language, there was some confusion made between a broken girth
and a broken neck, which gave rise to the distressing intelligence."
"That may be very possible," replied Lady Gordon, "but I shall
never in future believe any report of your misfortunes again, and if
you want me to grieve again for you, you must break your neck in
good earnest."
"Excuse me, but I have no wish to cause you any concern, Lady
Gordon, or to put your feelings to such a test."
"By the bye, when did you arrive, Howard?" enquired the baronet.
"About two hours ago; and I own I was rather surprised to find
my house shut up, and nobody at home; but if my servants thought
me dead, it was all very natural."
"No doubt they will tell you they were afraid of remaining lest you
should walk again," observed Sir William.
"As I do not know when they will return," continued he, "and I do
not wish to break into my house, I must throw myself on your
hospitality for to-day, if you will receive a poor wanderer."
Of course he was made extremely welcome by his friends, and
invited to remain as long as was convenient. It was very pleasant to
be so kindly received; but there was another voice he was longing to
hear welcome him, another hand he wished to press, another smile
to bless his eyes. As soon as he could he left Lady Gordon, and went
to look for Emma. In the breakfast-room, the library, the
conservatory, the flower-garden he sought her, but in vain; in fact
she had shut herself into her own room, to give utterance, in
grateful thanks, to the emotions which swelled her heart; emotions
far too powerful for words.
At the moment she could not have encountered him with anything
like a due and decorous dignity; had she seen him, she must have
been guilty of expressing too warmly her interest in his welfare: it
would not do to flatter him with a knowledge how very glad she was
at his having safely returned; for he was but a man, and as such,
liable of course to all the foibles of mankind: the vanity, the triumph,
the selfish gratification which such a dangerous knowledge would
create. She thought very well of him certainly, but the temptation to
conceit might be too strong, and she might have to rue the day if
she placed such confidence in him.
No, she would not see him till her feelings were in better order,
and more under her own control.
Such was her resolution as she sought the shelter of her dressing-
room; it did not occur to her, that he might consider he had a claim
on her attention, and a right to demand an interview with her; a
claim and a right which no man very much in love could be expected
to forego.
Having been quite unsuccessful in his search for her, he took a
very plain and straight-forward course to obtain what he wished,
going to Lady Gordon for assistance.
"Will you be my friend," said he, appealing to her with a look of
great concern, "my friend in a very important matter."
"Have I ever been otherwise, why should you ask?" replied she.
"Then procure me an interview with Emma—I cannot find her any
where, and I cannot exist longer in suspense. Dear Lady Gordon, do
pray have pity on me!"
"Yes!" replied she, affecting to look very grave, "I have pity on
you; and since you wish so much for an interview, I will try and
procure one, that is if Emma is not absolutely bent on refusing to
hear you. But are you prepared—can you stand the shock which
awaits you?"
"Good Heavens! what do you mean, Lady Gordon?" cried he,
catching her hand in his with an accent of alarm.
"Why, what do you expect?" said she, withdrawing her hand, "but
that she will refuse you; what else can you anticipate?"
"Refuse me, why—do not torment me—I am not afraid—" he
added, trying to smile.
"Upon my word, a very modest speech!" exclaimed she, "so you
feel no alarm—tranquil self-confidence possesses your soul. Emma
will be intensely gratified!"
"Dear Lady Gordon—" said he, pleadingly; but she would not
listen.
"So I am to call Miss Watson down to you, persuading her to come
with an assurance, that you feel so confident of what her answer will
be that you entertain no anxiety, no alarm. Is that what I am to
say?"
"Say anything you please, Lady Gordon," exclaimed he, in
desperation, "only procure me the sight of Miss Watson, and the
opportunity to speak to her."
"Very well, go to the library, and I will bring her there."
He anxiously hastened to the rendezvous she appointed; she
crossed the gallery to her friend's dressing-room.
On obtaining admission, she found Emma had been lying on the
sofa in a darkened room; she sat down by her, and affectionately
kissing her forehead and cheek, she said,
"I am come to congratulate you, my dear Miss Watson, that our
imaginary tragedy has proved an entire fable—Mr. Howard is quite
well, and all the loss on the occasion is that of a very pleasant
dance, which I had intended should be very much enjoyed."
"It seems so strange and incomprehensible," observed Emma,
putting back the ringlets from her forehead, "I could hardly believe
my eyes, or credit my senses, and as to speaking, that was out of
the question. I hope you did not think me very rude if you noticed
me, but the only thing I could do, was to run away."
"But now you have recovered your self-possession, and the use of
your speech, I hope you do not mean to seclude yourself here all
day; pray come and join us all. You had better."
"Perhaps I had," said Emma, "I will come with you in a moment;
just let me smooth my hair first."
"It is very nice I assure you, but I will wait as long as you please."
Miss Carr and Sir William were in the sitting-room; but Lady
Gordon did not stop there; to the great relief of Emma, who dreaded
the remarks of the young lady, they walked into the conservatory,
through it, and entered from the other end the library window.
Lord Osborne and Mr. Howard were there together, but the former
instantly took flight at their approach. Lady Gordon still keeping
Emma's hand under her own arm, led her up to Mr. Howard, and
said,
"I have brought my friend to congratulate the dead-alive, Mr.
Howard; she was wishing to say civil speeches to you like the rest of
us, but as I have done my duty in that way, and a twice told tale is
tedious, I shall leave you, to go after my brother."
As Emma had held out her hand to the gentleman, she could not
follow Lady Gordon in her flight, though looking exceedingly inclined
to do so; for he held her with a gentle pressure, and would not let
her go. His eyes were so earnestly bent upon hers, that she dared
not look up after the one glance she had given him; and she stood,
her slender fingers trembling in his grasp, longing to speak, but
wanting courage to break the silence.
"I am glad Miss Watson is not to be the only one from whom I
hear no word of welcome," said he gently. "If you knew how very
grateful I should feel for one sentence of kindness—even one look
which evinced interest, could you refuse me?"
"I assure you, Mr. Howard," said she, determined no longer to
stand silently blushing like a criminal before him; "I assure you it
was not want of interest, or kindly feeling towards you, which kept
me silent."
"Thank you—you were glad to see me again?"
"Indeed I was."
"And you guess—you must know and feel why I hurried home?"
"No, indeed," but the words were accompanied by so very deep a
blush, that they looked exceedingly like a falsehood.
"There was a letter, which I wrote, but to which I received no
answer, which hurried my movements—do you now know what I
mean?"
"I believe I do," she uttered in desperation finding he seemed
determined she should answer him.
"And though you would not write, you will condescend now to
answer that letter by word of mouth," taking her hand in both of his;
"I am sure you are too generous wilfully to torment me—and if you
had known how much pain your silence gave me, you would not
have allowed it to last so long."
"Mr. Howard," said Emma, looking up, but making no attempt to
withdraw her hand; "I only received that letter yesterday morning;
and as I then thought you were dead—you cannot imagine the pain
which the receipt of it occasioned me."
She spoke hurriedly, without considering the full value of her
words; but he saw the implied meaning—where was the man ever
blind to such a compliment. The speech he made on the occasion,
was a great deal too rapturous and lover-like to bear transcribing,
indeed, when lovers' speeches really come from the heart, they
would seldom be sufficiently intelligible to interest general readers.
There is so much understood by the pressure of the hands—so much
explained by the language of the eyes—and so much made up by
other signs well-known to the initiated, but unnecessary to detail to
those who have never gone through such an ordeal, that in most
cases it seems probable an accurate relation in words would be the
most tiresome, the most incomprehensible, the most ridiculous thing
in the world to those not taking a principal part in it.
Where the heart takes but a small share in the proceedings,
indeed, fine speeches may be made, but where the affections are
engaged, the meaning can be perfectly understood without them.
The result of his speech, and Emma's answer, was much more
favorable to his happiness, than the reply which she had made the
previous day to a similar question from Lord Osborne. She
acknowledged that she loved him, and that the dread of being poor,
or the desire of being great, would not prevent her promising to
become his wife.
When the first effervescence of his joy had subsided, and he was
able to speak in a calm and reasonable manner, and consider what
was best to be done, he urged her to come out with him into the
park, as the first step to securing her company perfectly undisturbed
—for, in the library, they were constantly exposed to be interrupted.
Here she tried to obtain from him some rational account as to why
he had tantalised her so long by deferring an explanation—which,
for any thing she could see to the contrary, might just as well, or
better, have been made long before. Since he professed he had
loved her even before she went to Croydon, why did he take no
steps to tell her so; or why, since he ended in writing, did he not
write to her there? Was it necessary to go as far as North Wales to
find courage for such an epistle.
He told her it was doubt and want of courage kept him silent—
then he contradicted himself and said it was really jealousy of Lord
Osborne. He had believed the young baron loved her.
So he might, perhaps, was Emma's reply—but what had that to do
with it; to make the admiration dangerous, it was necessary that she
should return his affection, "and surely, you never suspected me of
that?" said she.
"How could I tell? Might you not naturally be dazzled with the idea
of a coronet; why, should I have interfered with your advantage or
advancement?"
"As if it would be to my advantage to marry a man like Lord
Osborne," replied Emma. "I do not wish to say anything derogatory
to your friends, or to Lady Gordon's brother, but indeed I think you
might have given me credit for rather a different taste at least. I
have no wish either to flatter you too much; but I fancy, whether
better or worse, our tastes are more consonant than mine and Lord
Osborne's."
"But, my dearest Emma, did he not love you?"
"What right have you to ask me any such questions, Mr. Howard?
so long as I assure you, I did not love him, that ought to be
sufficient for you—let his feelings remain a secret."
"There should be no secrets between us, Emma."
"Very well—but there shall be between Lord Osborne and me."
"For shame, Emma, I shall certainly forbid anything of the kind."
"Set me the example of sincerity and openness then, tell me to
how many ladies you have made love—how many hopeless and
inextinguishable flames you have nourished, and how many hearts
you have found obdurate to your finest speeches."
Mr. Howard protested he had never loved any other woman, never
sought any other hand than hers, and never made fine speeches to
any one. With all his eloquence and ability he was not able to extract
from her the fact, that she had refused Lord Osborne. She had two
motives for her silence; a feeling of delicacy towards her rejected
suitor, and a decided determination not to flatter Howard's vanity by
such a mark of her preference. She thought it quite enough for him
to know himself accepted without learning, at least at present, how
many she had refused for his sake.
CHAPTER XV

Lady Gordon, and her husband, learnt with sincere pleasure, that
a happy understanding had been established between Emma and
her lover; they both hinted that the disappointment to Lord Osborne
would not be lasting, and that the attachment would on the whole
have done him good. He had improved so much during its progress,
had become so sociable and civilised by his affection, that he
seemed a different person; and whilst rejoicing at the change, they
trusted he would not relapse under the effects of his want of
success, but would prove himself worthy of his place in society, and
his position in the world.
As to the young man himself, he felt his disappointment most
acutely, but it did not make him more selfish than he had been. On
the contrary it seemed to give rise to a magnanimity of sentiment
which could hardly have been expected from him.
Two days after the engagement it was found he went down to see
Howard at the vicarage immediately after the post had come in.
That morning he had received an announcement of the death of the
old rector before mentioned. He now hastened to offer the living to
Howard, delighted to have it in his power thus to improve his
circumstances.
"Howard," said he, "I have learnt by this letter that the living of
Carsdean is vacant. I am glad of it—as I am sure it will make you
much more comfortable. Will you accept it?"
"My dear lord," said he, with much emotion, "you are too kind to
me: I am ashamed to accept such a benefit, when I have robbed
you of what you so much desired."
"Do not speak of that," said the other, "she took her choice, and
no doubt chose wisely; I always felt you were beloved, Howard,
even whilst I was fool enough to flatter myself with success: but I
am not angry either with her or you, and since I cannot make her
happy myself, I am glad I can help you to do so. This living was
always meant for you—but coming as it does just now, it gives me
very great pleasure."
"I knew you were generous," replied Howard, "and I can feel how
much satisfaction the power of obliging must confer."
"Make her happy, Howard, and when I can, I will come and see
you, but it is best at first that we should be apart. You accept my
wedding gift!"
"A noble one, like the heart which dictates it, and a welcome one
indeed since it removes the only obstacle to my marriage," replied
Howard.
"Howard, you are a lucky man; I would have given half my income
to have had the power of persuading her to accept the other half.
You know, I dare say, that she refused me?"
"No, indeed!"
"Did not Emma tell you? She did refuse me, and I loved her the
better for it, for it was entirely for your sake; but as I thought you
were dead then I did not take it so much to heart, because I trusted
to time and perseverance when my rival was removed."
"And when I came back and destroyed your dream, how you must
have hated me! I wonder you could shake hands as you did, and say
you were glad to see me."
"Howard," said Lord Osborne with much agitation, "if I thought
you were serious in what you say, I would never speak to you again;
I know you only say it to torment me, but is that generous when you
are the winning party?"
"I beg your pardon," said Howard holding out his hand; and no
more was said on the subject.
"What a pity it is," said Emma Watson to Howard when he was
joyfully detailing to her his happy prospects, and Lord Osborne's
generosity, "what a pity it is that Lord Osborne's manners are so
inferior to his mind. With so much good feeling and generosity of
sentiment, it is unfortunate that he should have so little engaging in
his appearance and address."
"I do not think so at all, Emma, for if his manners had been such
as you admire, and calculated to set off his good qualities, you
would certainly have been lost to me."
"What abominable conceit!" cried Emma; "you really take credit to
yourself, do you, for such very captivating manners yourself, since
you think that those alone are the passports to my good opinion."
"I did not mean to say that; I trust my other good qualities are so
remarkable that you have, in their favour, overlooked any little
deficiencies which might otherwise strike you in my manners."
"Modest, truly! What is the income of the living which his lordship
presents to you?"
"About a thousand a year, I believe, and a very pretty country and
pleasant neighbourhood. I have been there, and always thought I
should like it so very much."
"I am quite sorry to leave this pretty place though," said Emma
looking at the Vicarage near which they were wandering; "I am sure
the other cannot have so pleasant a garden, nor so pleasant a little
drawing-room. Those were happy days when we were snowed up
there."
They then went off into a long series of reminiscences and
explanations through which it would be useless, were it possible, to
follow them.
Emma spent one very happy week at the Castle after her
engagement; which was not the less agreeable to every one
concerned because both Lord Osborne and Miss Carr left it. He
quitted his house immediately after the conversation above
recorded; and she then decided that her visit had been long enough
to such dreadfully dull people as Rosa and her husband were
become: so she took leave of her dear friends and returned,
unsuccessful, home.
At the end of a week, Mr. Howard found it necessary to go too;
there was business connected with his new living which must be
attended to, and unwillingly he tore himself away.
Mrs. Willis still continued in Wales, for though Charles was better,
and indeed daily gaining strength, the physicians had so strongly
recommended sea air for the re-establishment of his health, that his
mother had decided on spending the summer on the sea-coast
there.
Howard's departure proved, however, only the prelude to Emma's
return to Croydon. Elizabeth's marriage was fast approaching, and
she pressed to see Emma again before that event. The idea of again
becoming an inmate of Robert's house was so very repulsive to
Emma that she demurred from that reason alone, and she was much
more inclined to accede to Miss Bridge's repeated invitations to
return to Burton. But this Elizabeth urged would be doing no good at
all; fourteen miles would as effectually preclude daily meetings as
forty, and would be only tantalizing instead of comfortable. The
affair was at length arranged through the intervention of Mr. Bridge,
who invited both his sister and her young friend to take up their
residence for a time in his Vicarage at Croydon. And so it was settled
at last, and after a hundred kind words and caresses from Lady
Gordon, and the most cordial good wishes from her husband, Emma
left the Castle, travelling, be it recorded, in one of Sir William's
carriages half the way, where she was to be met by Miss Bridge's
chariot, to convey her the latter half of the journey.
With no accident and no adventure she reached Croydon, and of
course received a far warmer welcome than when she had formerly
made the same journey.
Elizabeth was waiting to receive her—her face was seen through
the flowers in the drawing-room window, and she reached the
entrance door, and ran down the steps to open the carriage before
the fat, well-powdered footman had time to put on his livery coat.
She led her sister into the house, and in the passage pushed back
the bonnet and the dark curls from her cheeks, to see if she was as
pretty as ever. Then, before leading her into the drawing-room, she
paused again to make her guess who she would find there.
Emma suggested Mr. and Miss Bridge.
"You little goose," replied Elizabeth, "as if I should have thought it
worth while to make you guess that!"
Then throwing open the door she ushered her in, and in another
moment Emma was clasped in the arms of her dear brother Sam.
This was a very unexpected pleasure—she had hoped to see him
certainly, but never for a moment anticipated meeting him so soon.
It was the joint kindness of Miss Bridge and Elizabeth; the one well
remembering the affectionate terms in which Emma always spoke of
her brother had been suggesting the possibility of his coming, and
the other eager to carry out the plan had persuaded George Millar to
ask him to his house for the week preceding the wedding. He had
arrived that very afternoon, and after an introduction to his future
brother, had accompanied Elizabeth to meet Emma.
Emma had much to communicate to Sam; besides her own
prospects she had matters which must be interesting to him as
concerning himself. A farewell visit which she had paid to the
Edwards had brought another engagement to her knowledge. Mary
Edwards was soon to be married to Captain Hunter. She found them
tête-à-tête in the parlour when she entered, and appearances were
so very suspicious, that even without the direct information which
Mrs. Edwards subsequently whispered to her, she would have
concluded her brother's cause to be lost.
Mrs. Edwards appeared on the whole better reconciled to the
match than Emma, from her early recollections, would have
supposed. Perhaps she had discouraged Mary's partiality for the
Captain, from a doubt of his sincerity, which was now removed; or
perhaps finding herself in the minority, she had given up her
previous objections, because it was no use to persist in them;
whatever were her feelings, she had received Emma's
congratulations with a good grace, and Emma hoped there was no
ill-will implied in the message of compliments which she charged her
to deliver to their old acquaintance Mr. Sam Watson.
All this she had to communicate to Sam, who listened with
philosophy, and whistled sotto voce instead of an answer. Certainly
the part which piqued him most was Mrs. Edwards' message; for
some time indeed he had almost despaired of Mary's affection, but
he could not bear that the mother who had never been his friend,
should suppose he cared at all about it.
There seemed nothing wanting to complete the felicity of the
happy party assembled at the Rectory of Croydon. Perhaps indeed
Mr. Howard would not have been flattered had he supposed this the
case; but so it really was; Emma had parted from him so recently
that she hardly felt the want of his society yet, and the satisfaction
of knowing herself beloved was at present sufficient for her repose
of mind. The agitations and anxieties of suspense were over, and
were followed by a calmness and peace of mind which seemed all
that she could require. She had now as much to hear as to tell, for
Sam had been to Chichester, and seen Penelope and her husband,
had arranged the plan for his future establishment, and his
prospects were of a very bright character. Could he only have
commanded a couple of thousand pounds, besides what he
possessed, there would have been no difficulty at all in stepping into
a comfortable house and flourishing business. As it was, the
prospects which Penelope promised him should be realized in a short
time, were sufficient to raise his mind and ease his spirits.
CHAPTER XVI.

The next morning Emma had a succession of visitors. Miss Millar


was among the first and gayest of the number. She came up with
Sam immediately after breakfast, to spend a long day, and
expressed great satisfaction at seeing her again.
"You cannot think how dreadfully dull I have been," said she,
"almost ever since you went away. George being in love is the
stupidest thing in the world. Formerly when he had done with his
business, and escaped from his offices he used to be glad of my
society and would read or walk when I wanted him, but now all that
is quite changed, and if I do get a speech from him once in a week I
am taught to consider it a great favour. Upon my word it is a sad
disease."
"They say it is infectious," said Emma, laughing.
"Oh I trust not," cried Annie quite seriously, "I hope I shall escape
the infection, I have such a horror of the whole thing. I beg the
pardon of all such of the present company who may be engaged,
but I think that people in love are very ridiculous."
"Can you always discern at the first glance when they have the
disease," enquired Miss Bridge good-humouredly.
"Yes I think I can—but happily it leaves no marks, and when it is
passed, people may be as amiable as before. But it's a sad thing that
young people should be so constantly exposed to the danger. I hope
you will keep clear Emma, in spite of the atmosphere to which you
have removed."
"Is it worse than when I was here two months ago?" enquired
Emma, secretly smiling at her young friend's remarks.
"We shall soon see," replied Annie; "if there were any one to fall in
love with here, I am certain you would be in a dangerous position."
"Well, why should you except me?" said Mr. Bridge, "here I am a
bachelor, why may I not aspire to be considered as a dangerous
individual?"
"You, my dear Mr. Bridge—because you are engaged to me; you
know you long ago promised to marry me yourself," replied Annie.
"I am flattered at your remembering our engagement, young lady,
but I am astonished that you are left so long to me without
competition; I think you must be something like Beatrice."
"No, I never had lovers to mock," said she, "except Mr. Alfred
Fremantle, and he is the facsimile of Sir John Suckling's constant
lover, or rather he resembles him in constancy, but has none of his
wit to express it. What is it he says—
"I have been in love three days,
And shall be three days more."

"I cannot remember the words exactly, but it is something to that


effect."
Sam turned round from the window, and repeated the lines to
which Annie alluded. She looked astonished.
"How came you to know them?" said she.
"I read them amongst his poems," was his answer.
"I thought you were a surgeon, Mr. Samuel Watson," said she still
in amazement, "and though never doubting that you knew a great
deal of anatomy and such things, did not expect you would be
acquainted with love poetry."
"And is it to want of taste or want of time, Miss Millar, that you
would attribute my imaginary ignorance?"
"I do not wish to offend you, but certainly I had expected a
surgeon's tastes to be different; and I should have referred a case of
dislocation or fracture to you, with much more faith than a failure of
memory."
"You thought I could mend your finger better than a broken verse,
and that though I might make you whole, I should make a line halt
—was that it?"
"I believe it was, and my amazement is so great, I do not know
when I shall recover," replied she saucily.
"I know you always had a strong prejudice against the medical
profession," said Mr. Bridge smiling, "you considered one specimen
the type of the whole class."
"I am delighted to hear it," exclaimed Sam, "I like of all things to
meet with prejudiced people, one has such a pleasure in disputing
with them; good, strong prejudices are delightful things, they are so
constantly changing their color and complexion; for I have often
observed a strong dislike converted into a decided approbation,
whilst the owner is unaware of the change, and gravely assures you
he never alters his mind."
"That must be a man's prejudice, Mr. Watson," said Annie,
"women are much more consistent. I have hated doctors, surgeons
and apothecaries ever since I was five years old, and Mr. Morgan
gave me some bon-bons which made me sick. I have always
distrusted them since that."
"I am not at all surprised," said Sam, with much gravity; "such an
offence was unpardonable, and well deserves to be visited on the
whole of the medical profession by your unchanging and
unmitigated contempt. After this we cannot allow your dislike to be
called a prejudice!"
"Is your brother always as impertinent to every young woman as
he is to me?" enquired Annie, turning to Emma, "he seems
determined to quarrel with me—has he naturally a bad temper?"
"Really I do not know," replied Emma, "I have seen so little of
him, and never with any other young ladies; do you imagine want of
temper a necessary accompaniment to his profession?"
"Oh no, I am not quite so bad as that," said she laughing, "doctors
ought to be particularly bland and insinuating, able to make all the
bitter realities they inflict on one, pass easily under the sweetening
cover of a smile and honied words."
They were interrupted by the arrival of other visitors. Emma
having just arrived from a prolonged visit to Lady Gordon at Osborne
Castle, was likely to become a very popular character at Croydon;
there was so much virtue comprised in the friendship of a baronet's
wife, and as it was whispered, the admiration of her brother; for
accounts of his visit to Croydon had been whispered abroad, and
such an act could only be attributed to one motive. All her former
acquaintance looked on her as a baroness elect, and all began to
find out what a very charming girl they had always thought her.
They would not for the world neglect calling on that sweet, amiable
Emma Watson. They were so delighted to see her back again; they
were so eager that she should make a long stay amongst them all.
Croydon would be so gay with all that was going on. The three Miss
Watsons had been such a very great addition, it had never been like
itself since they came.
Amongst her visitors were her sister-in-law and niece. Emma was
really glad to see the little girl, who clung to her and begged her to
come back again very soon, as she had no one to teach her now so
nicely as she had been used to do.
"My dear Emma," cried Jane, "how delighted I am to see you
again, and so blooming as you are looking; upon my word, I really
begin to see what Mr. Morgan once said of our likeness. I hope you
left your kind friends at the Castle well—charming young man Lord
Osborne; nothing of hauteur or pride about him. He seemed quite at
home with me—but, to be sure, when people have lived in the same
sort of society, they acquire a sort of ease towards each other. I
cannot make out that he knew my uncle, Sir Thomas, but he
reminded me very much of some of the young men that I used to
see at his house."
Here she paused, and Emma, thinking some sort of remark
necessary, and yet not having the least idea what she was expected
to reply to, only ventured to enquire for her brother.
"Mr. Watson? oh, he is well enough, I believe! I have not seen him
this morning, however, for he breakfasted early with Elizabeth; I
believe, if he can, he will come and see you some day, but indeed,
Emma, you must come to us. We have plenty of room, and should
you have any friends coming, we could easily accommodate them
too. I would not mind putting myself to any inconvenience for your
sake, my dear."
"I am sure I feel much obliged, but at present I mast decline your
offers," said Emma, trying to speak with warmth.
"Oh, no, not at all, I assure you, you could expect nothing less
from us; we, you know, are your nearest relations, and under certain
circumstances, we may naturally be expected to show our
approbation and patronage; every young woman has a claim on her
own family; so you will certainly come back to us."
"Indeed I must decline Jane," said Emma firmly, "at least, for the
present."
"And indeed, dear, I will not take a refusal, so I shall certainly get
a room ready for you, and another shall be prepared for a friend
whenever it is needed. Did you leave Lord Osborne at the Castle, did
you say?"
Emma replied in the negative of course.
"Really, for so young a man," continued Mrs. Watson, "his air and
manner were remarkable; so exceedingly high-bred and aristocratic.
I have seldom seen manners which delighted me more, I assure
you. Don't blush so, my dear," added she, making believe to
whisper; "nobody here knows anything about him, except you and
me."
"Then allow me to suggest that, as a reason for dropping the
subject," said Emma, "and recurring to some one more generally
interesting."
"La, my dear," laughed Jane, "it looks very suspicious, your not
choosing to talk of him. However, if you don't like it, I will say no
more—I would not vex you for the world, my dear sister—what a
sweet pretty gown that is you have on; Lady Gordon's choice,
beyond a doubt."
"No, indeed," replied Emma, smiling, "but I dare say Miss Bridge
remembers choosing it for me, whilst we were at Burton."
"What sort of bonnets are most in fashion, Emma?" asked Jane,
"Elizabeth's wedding bonnet is, to my taste, vastly ugly; not that I
pretend to be a judge at all,—though I used to be thought to have
some taste—but I dare say, she was quite right not to take my
advice; one must not expect to be always judged candidly—every
one cannot see one's merits; so I am not surprised—how are heads
worn now?"
Emma tried to recall and describe some of the bonnets she had
seen at Lady Gordon's fête, but Mrs. Watson pronounced her
description unsatisfactory, wished she had been there to see it, and
wondered Margaret had never thought of asking her over for that
day. She might have done it so easily, Jane was sure, and
considering how very kind Jane had been to Margaret, and how
large a share Robert had had in bringing about her marriage, she
thought it was the least she could have done, to shew her gratitude
and mark her sense of former favors.
Emma tried to excuse Margaret, but fortunately, before she had
wasted much eloquence in that way, Jane perceived it was time to
withdraw.
No sooner was she out of the room than Sam returned from the
window where he had ensconced himself during her visit, and
exclaimed:
"Really, I hope it is not very wicked, but that woman puts me
more out of patience than all the rest of the world of Croydon put
together."
"The rest of the world of Croydon is infinitely obliged to you," said
Annie Millar, walking up to him; "allow me, sir, as its representative,
to make you a grateful curtsey on the occasion. You can bear with
us all better than with your sister-in-law?"
She made him a saucy curtsey as she spoke, looking exceedingly
pretty as she did so.
"You ought to be ashamed of yourself for such a speech, Sam,"
said Emma, at the same moment; "I am sure she meant to be kind."
"Yes, but who did she mean to be kind to, Emma? was it to Emma
Watson or some imaginary future baroness," replied Sam.
"Why should I enquire into motives, or attribute a bad ones? She
might have been just the same if Lord Osborne had never existed."
"I do not believe it," persisted he.
"Your brother wants to see how violent prejudices become him,"
said Annie Millar, "do not argue with him—he does not deserve it."
"Miss Millar is angry with me for the implied reflection on
Croydon," said he, "but I knew she had not been brought up here,
and never thought of her as belonging to the place."
"And what do you know of Croydon, to give you so dark an
opinion of its inhabitants?" enquired she, "I do not think we slander,
or court here worse than in other places."
"I have heard a great deal about you all, from my two sisters,"
replied he; "Emma especially, gave me lively pictures of your
proceedings. I was well acquainted with you and your irreconcileable
prejudices against unfortunate surgeons several months ago.
"Oh! you used to correspond with Emma, did you?" said she.
"To be sure I did; would not you write to your brother, Miss
Millar?"
"Perhaps I might—but I do not think he would read it if I did—
especially if I crossed the letter! George is not fond of letters!"
"But you like them yourself?"
"Oh yes! I should like to have seen Emma's to you. I am sure they
would have been very interesting—does she not write very clever
letters?"
"I used to think them interesting and clever—but, perhaps, that
was because I am only a surgeon, and could not be expected to
have either taste or judgment," replied he, with mock humility.
"Oh, but I think you might have both on that subject—your
admiring Emma's letters is decidedly a proof of it."
"Even though I am a surgeon?"
"Yes, even though you are a surgeon."
"And though you have never seen any of those letters, the liking
which secures your approbation?"
"Ah! you are too clever for me—you want to make me contradict
myself, or something of that sort—but I will not argue with you, and
then you cannot prove me wrong."
"You need not say you will not—you cannot argue; no woman can,
they can only feel, and express those feelings."
"And taking the converse of your proposition, Mr. Samuel Watson,
I presume that men surpass us so much in argument, because they
have no feelings. Am I to infer that?"
"We have them, but we guide them, not they us. It is exactly the
reverse with you, and you never see more than one side of a
question," replied he, in the most straightforward manner possible.
"Yes; you have some feelings very apparent," replied she,
"contempt for women is evidently a prominent one."
"Contempt, Miss Millar! no indeed, you do me injustice, if you
think so—but, perhaps, you imagine that a part of my profession?"
"I certainly think it one that hardens all the feelings," said she
turning away and thus putting a stop to the conversation. It had
been settled that the whole vicarage party were to dine at the
Millars' that afternoon, and it now became time for those who did
not belong to it, to return home to prepare for dinner. Elizabeth
Watson, her brother, and Miss Millar accordingly set off together.
Elizabeth taking Sam's arm, and Annie walking on her other side;
they made the passage with scarcely a syllable passing between
them; and as the Millars' house was nearer the vicarage than the
residence of the Robert Watsons, Annie left them at the door of her
house.
"What do you think of Annie Millar?" cried Elizabeth eagerly, as
she and her brother proceeded together. "Is she not charming?"
"Yes, she is a very fine girl," replied he quietly.
"Oh, Sam," continued Elizabeth, "I do so wish you would like her;
I have always thought she was exactly suited to you. She will have
twenty thousand pounds of her own, and I am sure she is much
better worth liking than Mary Edwards."
Elizabeth, in her open-hearted zeal for Sam's welfare, never for a
moment reflected that she was taking the most probable way to
prejudice him against her, since there is nothing which in general
has more influence that way than a sister's praises; whilst the surest
means to interest a man's favor for any young woman, is to abuse or
find fault with her. True to his feelings as a man, Sam of course
replied:
"If you reckon her merits by her pounds, I dare say she is, but I
do not see otherwise in what she surpasses Mary Edwards."
Fortunately they had just arrived at the termination of their walk,
and Sam having seen his sister safely deposited in the house,
returned alone to George Millar's residence.
The evening was a very merry one, for the whole party was well
assorted and in good spirits, in spite, as Annie observed, of the
tremendous event hanging over some of them. But it was not
Elizabeth's nature to be very pensive; positive evils did not make her
sad, it was not likely then that what she firmly believed to be a
positive good, would weigh heavily on her spirits. She was perfectly
satisfied with her future prospects, and could look forward without
any trembling emotion to her approaching fate. After dinner, when
the ladies had returned to the drawing-room, Elizabeth, who was
burning with anxiety to make known the fact of Emma's
engagement, began enquiring of Annie, if she thought her sister
changed since her visit to Osborne Castle. Miss Millar declared she
was looking better, plumper, gayer, prettier than ever; but in no
other respect was she altered.
"Then you do not suspect her of having fallen in love?" enquired
Miss Watson laughingly.
"I see no trace of it," said the other, examining Emma from head
to foot with a grave air, taking a candle from the chimney-piece to
throw more light on her countenance. "I see no symptoms at all,
pray do not attempt to raise such unfounded imputations against
her, Elizabeth; your insinuations disgrace you!"
"Nay then, in my own justification I must inform you, Annie,—shall
I tell, Emma—or do you blush to own the truth?" enquired Miss
Watson with a significant smile.
"Not that she is engaged to that Lord Osborne!" cried Annie,
starting back with horror, "you are not going to confirm the rumour
which Miss Jenkins and Mrs. Watson so industriously circulate, and
that brought Miss Morgan and Miss Fenton to call on her to-day. This
can never be."
"My dear Annie," said Emma smiling quietly, "that Lord Osborne,
as you call him, is a very estimable young man, and would make any
woman who liked him very happy I have no doubt."
"Indeed! well I hope he will, if you are going to marry him," said
Annie with a mournful countenance and expression, that made
Elizabeth laugh out-right, "but in that case, when you are Lady
Osborne, we shall never see you again."
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookultra.com

You might also like