Version Control with Git [PDF]

Get up to speed on Git for tracking, branching, merging, and managing code revisions. Through a series of step-by-step tutorials, this practical guide takes you quickly from Git fundamentals to advanced techniques, and provides friendly yet rigorous advice for navigating the many functions of this open source version control system.This thoroughly revised edition also includes tips for manipulating trees, extended coverage of the reflog and stash, and a complete introduction to the GitHub repository. Git lets you manage code development in a virtually endless variety of ways, once you understand how to harness the system’s flexibility. This book shows you how.

  • Learn how to use Git for several real-world development scenarios
  • Gain insight into Git’s common-use cases, initial tasks, and basic functions
  • Use the system for both centralized and distributed version control
  • Learn how to manage merges, conflicts, patches, and diffs
  • Apply advanced techniques such as rebasing, hooks, and ways to handle submodules
  • Interact with Subversion (SVN) repositories—including SVN to Git conversions
  • Navigate, use, and contribute to open source projects though GitHub

Table of Contents

  1. Chapter 1 Introduction

    1. Background

    2. The Birth of Git

    3. Precedents

    4. Timeline

    5. What’s in a Name?

  2. Chapter 2 Installing Git

    1. Using Linux Binary Distributions

    2. Obtaining a Source Release

    3. Building and Installing

    4. Installing Git on Windows

  3. Chapter 3 Getting Started

    1. The Git Command Line

    2. Quick Introduction to Using Git

    3. Configuration Files

    4. Inquiry

  4. Chapter 4 Basic Git Concepts

    1. Basic Concepts

    2. Object Store Pictures

    3. Git Concepts at Work

  5. Chapter 5 File Management and the Index

    1. It’s All About the Index

    2. File Classifications in Git

    3. Using git add

    4. Some Notes on Using git commit

    5. Using git rm

    6. Using git mv

    7. A Note on Tracking Renames

    8. The .gitignore File

    9. A Detailed View of Git’s Object Model and Files

  6. Chapter 6 Commits

    1. Atomic Changesets

    2. Identifying Commits

    3. Commit History

    4. Finding Commits

  7. Chapter 7 Branches

    1. Reasons for Using Branches

    2. Branch Names

    3. Using Branches

    4. Creating Branches

    5. Listing Branch Names

    6. Viewing Branches

    7. Checking out Branches

    8. Deleting Branches

  8. Chapter 8 Diffs

    1. Forms of the git diff Command

    2. Simple git diff Example

    3. git diff and Commit Ranges

    4. git diff with Path Limiting

    5. Comparing How Subversion and Git Derive diffs

  9. Chapter 9 Merges

    1. Merge Examples

    2. Working with Merge Conflicts

    3. Merge Strategies

    4. How Git Thinks About Merges

  10. Chapter 10 Altering Commits

    1. Caution About Altering History

    2. Using git reset

    3. Using git cherry-pick

    4. Using git revert

    5. reset, revert, and checkout

    6. Changing the Top Commit

    7. Rebasing Commits

  11. Chapter 11 The Stash and the Reflog

    1. The Stash

    2. The Reflog

  12. Chapter 12 Remote Repositories

    1. Repository Concepts

    2. Referencing Other Repositories

    3. Example Using Remote Repositories

    4. Remote Repository Development Cycle in Pictures

    5. Remote Configuration

    6. Working with Tracking Branches

    7. Adding and Deleting Remote Branches

    8. Bare Repositories and git push

  13. Chapter 13 Repository Management

    1. A Word About Servers

    2. Publishing Repositories

    3. Repository Publishing Advice

    4. Repository Structure

    5. Living with Distributed Development

    6. Knowing Your Place

    7. Working with Multiple Repositories

  14. Chapter 14 Patches

    1. Why Use Patches?

    2. Generating Patches

    3. Mailing Patches

    4. Applying Patches

    5. Bad Patches

    6. Patching Versus Merging

  15. Chapter 15 Hooks

    1. Installing Hooks

    2. Available Hooks

  16. Chapter 16 Combining Projects

    1. The Old Solution: Partial Checkouts

    2. The Obvious Solution: Import the Code into Your Project

    3. The Automated Solution: Checking out Subprojects Using Custom Scripts

    4. The Native Solution: gitlinks and git submodule

  17. Chapter 17 Submodule Best Practices

    1. Submodule Commands

    2. Why Submodules?

    3. Submodules Preparation

    4. Why Read Only?

    5. Why Not Read Only?

    6. Examining the Hashes of Submodule Commits

    7. Credential Reuse

    8. Use Cases

    9. Multilevel Nesting of Repos

    10. Submodules on the Horizon

  18. Chapter 18 Using Git with Subversion Repositories

    1. Example: A Shallow Clone of a Single Branch

    2. Pushing, Pulling, Branching, and Merging with git svn

    3. Miscellaneous Notes on Working with Subversion

  19. Chapter 19 Advanced Manipulations

    1. Using git filter-branch

    2. How I Learned to Love git rev-list

    3. Interactive Hunk Staging

    4. Recovering a Lost Commit

  20. Chapter 20 Tips, Tricks, and Techniques

    1. Interactive Rebase with a Dirty Working Directory

    2. Remove Left-Over Editor Files

    3. Garbage Collection

    4. Split a Repository

    5. Tips for Recovering Commits

    6. Subversion Conversion Tips

    7. Manipulating Branches from Two Repositories

    8. Recovering from an Upstream Rebase

    9. Make Your Own Git Command

    10. Quick Overview of Changes

    11. Cleaning Up

    12. Using git-grep to Search a Repository

    13. Updating and Deleting refs

    14. Following Files that Moved

    15. Keep, But Don’t Track, This File

    16. Have You Been Here Before?

  21. Chapter 21 Git and GitHub

    1. Repo for Public Code

    2. Creating a GitHub Repository

    3. Social Coding on Open Source

    4. Watchers

    5. News Feed

    6. Forks

    7. Creating Pull Requests

    8. Managing Pull Requests

    9. Notifications

    10. Finding Users, Projects, and Code

    11. Wikis

    12. GitHub Pages (Git for Websites)

    13. In-Page Code Editor

    14. Subversion Bridge

    15. Tags Automatically Becoming Archives

    16. Organizations

    17. REST API

    18. Social Coding on Closed Source

    19. Eventual Open Sourcing

    20. Coding Models

    21. GitHub Enterprise

    22. GitHub in Sum


You can also get this PDF by using our Android Mobile App directly:


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.