Pro Git

A book about Git and version control in general.

Pro Git /2

Table of Contents /3

Licence /7

Preface by Scott Chacon /8

Preface by Ben Straub /9

Dedications /10

Contributors /11

Introduction /14

Getting Started /16

About Version Control /16

A Short History of Git /20

What is Git? /20

The Command Line /24

Installing Git /24

First-Time Git Setup /27

Getting Help /30

Summary /31

Git Basics /32

Getting a Git Repository /32

Recording Changes to the Repository /34

Viewing the Commit History /46

Undoing Things /52

Working with Remotes /56

Tagging /61

Git Aliases /66

Summary /68

Git Branching /69

Branches in a Nutshell /69

Basic Branching and Merging /76

Branch Management /85

Branching Workflows /88

Remote Branches /91

Rebasing /101

Summary /110

Git on the Server /111

The Protocols /111

Getting Git on a Server /116

Generating Your SSH Public Key /118

Setting Up the Server /119

Git Daemon /122

Smart HTTP /123

GitWeb /125

GitLab /126

Third Party Hosted Options /130

Summary /131

Distributed Git /132

Distributed Workflows /132

Contributing to a Project /135

Maintaining a Project /156

Summary /171

GitHub /172

Account Setup and Configuration /172

Contributing to a Project /177

Maintaining a Project /197

Managing an organization /211

Scripting GitHub /214

Summary /223

Git Tools /224

Revision Selection /224

Interactive Staging /232

Stashing and Cleaning /236

Signing Your Work /242

Searching /245

Rewriting History /249

Reset Demystified /257

Advanced Merging /276

Rerere /293

Debugging with Git /299

Submodules /302

Bundling /323

Replace /326

Credential Storage /335

Summary /340

Customizing Git /341

Git Configuration /341

Git Attributes /351

Git Hooks /359

An Example Git-Enforced Policy /362

Summary /371

Git and Other Systems /372

Git as a Client /372

Migrating to Git /407

Summary /423

Git Internals /424

Plumbing and Porcelain /424

Git Objects /425

Git References /435

Packfiles /439

The Refspec /442

Transfer Protocols /445

Maintenance and Data Recovery /450

Environment Variables /457

Summary /462

Appendix A: Git in Other Environments /463

Graphical Interfaces /463

Git in Visual Studio /468

Git in Visual Studio Code /469

Git in IntelliJ / PyCharm / WebStorm / PhpStorm / RubyMine /469

Git in Sublime Text /470

Git in Bash /470

Git in Zsh /471

Git in PowerShell /473

Summary /475

Appendix B: Embedding Git in your Applications /476

Command-line Git /476

Libgit2 /476

JGit /481

go-git /484

Dulwich /486

Appendix C: Git Commands /488

Setup and Config /488

Getting and Creating Projects /490

Basic Snapshotting /491

Branching and Merging /493

Sharing and Updating Projects /495

Inspection and Comparison /497

Debugging /498

Patching /499

Email /499

External Systems /501

Administration /501

Plumbing Commands /502

Index /503