Pro Git

( 4 )


Pro Git (Second Edition) is your fully-updated guide to Git and its usage in the modern world. Git has come a long way since it was first developed by Linus Torvalds for Linux kernel development. It has taken the open source world by storm since its inception in 2005, and this book teaches you how to use it like a pro.

Effective and well-implemented version control is a necessity for successful web projects, whether large or small. With this book you’ll learn how to master the ...

See more details below
Paperback (2nd ed. 2014)
$56.42 price
(Save 5%)$59.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (7) from $41.15   
  • New (5) from $41.15   
  • Used (2) from $56.41   
Pro Git

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$20.99 price
(Save 25%)$27.99 List Price
This digital version does not exactly match the physical book displayed here.


Pro Git (Second Edition) is your fully-updated guide to Git and its usage in the modern world. Git has come a long way since it was first developed by Linus Torvalds for Linux kernel development. It has taken the open source world by storm since its inception in 2005, and this book teaches you how to use it like a pro.

Effective and well-implemented version control is a necessity for successful web projects, whether large or small. With this book you’ll learn how to master the world of distributed version workflow, use the distributed features of Git to the full, and extend Git to meet your every need.

Written by Git pros Scott Chacon and Ben Straub, Pro Git (Second Edition) builds on the hugely successful first edition, and is now fully updated for Git version 2.0, as well as including an indispensable chapter on GitHub. It’s the best book for all your Git needs.

What you’ll learn

• Effectively use Git, either as a programmer or a project leader

• Become a fluent Git user

• Master branching, using Git on the server, and on other systems

• Integrate Git in your development workflow

• Migrate programming projects from other SCMs to Git

• Extend Git for your personal project needs

• Effectively use GitHub

Who this book is for

This book is for all open source developers: you are bound to encounter Git somewhere in the course of your working life. Proprietary software developers will appreciate Git’s enormous scalability, since it is used for the Linux project, which comprises thousands of developers and testers.

Table of Contents

1. Getting Started

2. Git Basics

3. Git Branching

4. Git on the Server

5. Distributed Git

6. GitHub

7. Git Tools

8. Customizing Git

9. Git and Other Systems

10. Git Internals

Read More Show Less

Product Details

  • ISBN-13: 9781484200773
  • Publisher: Apress
  • Publication date: 11/12/2014
  • Edition description: 2nd ed. 2014
  • Edition number: 2
  • Pages: 456
  • Sales rank: 469,082
  • Product dimensions: 7.50 (w) x 9.00 (h) x 0.90 (d)

Meet the Author

A biography is not available for this author.
Read More Show Less

Table of Contents

Foreword xv

About the Author xvii

About the Technical Reviewer xviii

Acknowledgments xix

Introduction xxi

Chapter 1 Getting Started 1

About Version Control 1

Local Version Control Systems 2

Centralized Version Control Systems 3

Distributed Version Control Systems 4

A Short History of Git 5

Git Basics 5

Snapshots, Not Differences 6

Nearly Every Operation Is Local 7

Git Has Integrity 7

Git Generally Only Adds Data 7

The Three States 8

Installing Git 9

Installing from Source 9

Installing on Linux 10

Installing on Mac 10

Installing on Windows 11

First-Time Git Setup 11

Your Identity 11

Your Editor 12

Your Diff Tool 12

Checking Your Settings 12

Getting Help 13

Summary 13

Chapter 2 Git Basics 15

Getting a Git Repository 15

Initializing a Repository in an Existing Directory 15

Cloning an Existing Repository 16

Recording Changes to the Repository 16

Checking the Status of Your Files 17

Tracking New Files 18

Staging Modified Files 18

Ignoring Files 20

Viewing Your Staged and Unstaged Changes 20

Committing Your Changes 23

Skipping the Staging Area 24

Removing Files 24

Moving Files 25

Viewing the Commit History 26

Limiting Log Output 30

Using a GUI to Visualize History 31

Undoing Things 32

Changing Your Last Commit 32

Unstaging a Staged File 33

Unmodifying a Modified File 34

Working with Remotes 35

Showing Your Remotes 35

Adding Remote Repositories 36

Fetching and Pulling from Your Remotes 36

Pushing to Your Remotes 37

Inspecting a Remote 37

Removing and Renaming Remotes 38

Tagging 38

Listing Your Tags 39

Creating Tags 39

Verifying Tags 41

Tagging Later 42

Sharing Tags43

Tips and Tricks 43

Auto-Completion 43

Git Aliases 44

Summary 45

Chapter 3 Git Branching 47

What a Branch Is 47

Basic Branching and Merging 53

Basic Branching 53

Basic Merging 57

Basic Merge Conflicts 58

Branch Management 60

Branching Workflows 61

Long-Running Branches 62

Topic Branches 63

Remote Branches 64

Pushing 68

Tracking Branches 69

Deleting Remote Branches 69

Rebasing 70

The Basic Rebase 70

More Interesting Rebases 72

The Perils of Rebasing 74

Summary 77

Chapter 4 Git on the Server 79

The Protocols 79

Local Protocol 80

The SSH Protocol 81

The Git Protocol 81

The HTTP/S Protocol 82

Getting Git on a Server 83

Putting the Bare Repository on a Server 84

Small Setups 85

SSH Access 85

Generating Your SSH Public Key 85

Setting Up the Server 86

Public Access 88

GitWeb 90

Gitosis 91

Git Daemon 95

Hosted Git 96

GitHub 97

Setting Up a User Account 97

Creating a New Repository 99

Importing from Subversion 101

Adding Collaborators 102

Your Project 103

Forking Projects 104

GitHub Summary 105

Summary 105

Chapter 5 Distributed Git 107

Distributed Workflows 107

Centralized Workflow 107

Integration-Manager Workflow 108

Dictator and Lieutenants Workflow 109

Contributing to a Project 110

Commit Guidelines 111

Private Small Team 112

Private Managed Team 118

Public Small Project 124

Public Large Project 127

Summary 129

Maintaining a Project 130

Working in Topic Branches 130

Applying Patches from E-mail 130

Checking Out Remote Branches 133

Determining What Is Introduced 134

Integrating Contributed Work 135

Tagging Your Releases 140

Generating a Build Number 141

Preparing a Release 141

The Shortlog 142

Summary 142

Chapter 6 Git Tools 143

Revision Selection 143

Single Revisions 143

Commit Ranges 147

Interactive Staging 150

Stashing 153

Stashing Your Work 154

Creating a Branch from a Stash 156

Rewriting History 156

Changing the Last Commit 156

Changing Multiple Commit Messages 157

Reordering Commits 158

Squashing a Commit 159

Splitting a Commit 160

The Nuclear Option: filter-branch 160

Debugging with Git 162

File Annotation 162

Binary Search 163

Submodules 165

Starting with Submodules 165

Cloning a Project with Submodules 167

Superprojects 169

Issues with Submodules 169

Subtree Merging 171

Summary 173

Chapter 7 Customizing Git 175

Git Configuration 175

Basic Client Configuration 176

Colors in Git 178

External Merge and Diff Tools 179

Formatting and Whitespace 181

Server Configuration 183

Git Attributes 184

Binary Files 184

Keyword Expansion 186

Exporting Your Repository 189

Merge Strategies 190

Git Hooks 190

Installing a Hook 190

Client-Side Hooks 191

Server-Side Hooks 192

An Example Git-Enforced Policy 193

Server-Side Hook 193

Client-Side Hooks 199

Summary 202

Chapter 8 Git and Other Systems 203

Git and Subversion 203

git svn 203

Setting Up 204

Getting Started 204

Committing Back to Subversion 206

Pulling in New Changes 207

Git Branching Issues 208

Subversion Branching 209

Subversion Commands 210

Git-Svn Summary 212

Migrating to Git 212

Importing 213

Perforce 214

A Custom Importer 216

Summary 221

Chapter 9 Git Internals 223

Plumbing and Porcelain 223

Git Objects 224

Tree Objects 226

Commit Objects 228

Object Storage 231

Git References 232

The HEAD 233

Tags 234

Remotes 235

Packfiles 235

The Refspec 238

Pushing Refspecs 239

Deleting References 240

Transfer Protocols 240

The Dumb Protocol 240

The Smart Protocol 242

Downloading Data 243

Maintenance and Data Recovery 244

Maintenance 244

Data Recovery 245

Removing Objects 247

Summary 250

Appendix Creative Commons Legal Code 251

Index 259

Read More Show Less

Customer Reviews

Average Rating 4
( 4 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 4 Customer Reviews
  • Anonymous

    Posted December 27, 2011

    No text was provided for this review.

  • Anonymous

    Posted October 31, 2011

    No text was provided for this review.

  • Anonymous

    Posted August 3, 2011

    No text was provided for this review.

  • Anonymous

    Posted February 22, 2011

    No text was provided for this review.

Sort by: Showing all of 4 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)