1. Preface and Dedications
  2. Contributors
  3. Introduction
  4. Getting Started
    1. About Version Control
      1. Local Version Control Systems
      2. Centralized Version Control Systems
      3. Distributed Version Control Systems
    2. A Short History of Git
    3. Git Basics
      1. Snapshots, Not Differences
      2. Nearly Every Operation Is Local
      3. Git Has Integrity
      4. Git Generally Only Adds Data
      5. The Three States
    4. The Command Line
    5. Installing Git
      1. Installing on Linux
      2. Installing on Mac
      3. Installing on Windows
      4. Installing from Source
    6. First-Time Git Setup
      1. Your Identity
      2. Your Editor
      3. Checking Your Settings
    7. Getting Help
    8. Summary
  5. Git Basics
    1. Getting a Git Repository
      1. Initializing a Repository in an Existing Directory
      2. Cloning an Existing Repository
    2. Recording Changes to the Repository
      1. Checking the Status of Your Files
      2. Tracking New Files
      3. Staging Modified Files
      4. Short Status
      5. Ignoring Files
      6. Viewing Your Staged and Unstaged Changes
      7. Committing Your Changes
      8. Skipping the Staging Area
      9. Removing Files
      10. Moving Files
    3. Viewing the Commit History
      1. Limiting Log Output
    4. Undoing Things
      1. Unstaging a Staged File
      2. Unmodifying a Modified File
    5. Working with Remotes
      1. Showing Your Remotes
      2. Adding Remote Repositories
      3. Fetching and Pulling from Your Remotes
      4. Pushing to Your Remotes
      5. Inspecting a Remote
      6. Removing and Renaming Remotes
    6. Tagging
      1. Listing Your Tags
      2. Creating Tags
      3. Annotated Tags
      4. Lightweight Tags
      5. Tagging Later
      6. Sharing Tags
      7. Checking out Tags
    7. Git Aliases
    8. Summary
  6. Git Branching
    1. Branches in a Nutshell
      1. Creating a New Branch
      2. Switching Branches
    2. Basic Branching and Merging
      1. Basic Branching
      2. Basic Merging
      3. Basic Merge Conflicts
    3. Branch Management
    4. Branching Workflows
      1. Long-Running Branches
      2. Topic Branches
    5. Remote Branches
      1. Pushing
      2. Tracking Branches
      3. Pulling
      4. Deleting Remote Branches
    6. Rebasing
      1. The Basic Rebase
      2. More Interesting Rebases
      3. The Perils of Rebasing
      4. Rebase When You Rebase
      5. Rebase vs. Merge
    7. Summary
  7. Git on the Server
    1. The Protocols
      1. Local Protocol
      2. The HTTP Protocols
      3. The SSH Protocol
      4. The Git Protocol
    2. Getting Git on a Server
      1. Putting the Bare Repository on a Server
      2. Small Setups
    3. Generating Your SSH Public Key
    4. Setting Up the Server
    5. Git Daemon
    6. Smart HTTP
    7. GitWeb
    8. GitLab
      1. Installation
      2. Administration
      3. Basic Usage
      4. Working Together
    9. Third Party Hosted Options
    10. Summary
  8. Distributed Git
    1. Distributed Workflows
      1. Centralized Workflow
      2. Integration-Manager Workflow
      3. Dictator and Lieutenants Workflow
      4. Workflows Summary
    2. Contributing to a Project
      1. Commit Guidelines
      2. Private Small Team
      3. Private Managed Team
      4. Forked Public Project
      5. Public Project over Email
      6. Summary
    3. Maintaining a Project
      1. Working in Topic Branches
      2. Applying Patches from Email
      3. Checking Out Remote Branches
      4. Determining What Is Introduced
      5. Integrating Contributed Work
      6. Tagging Your Releases
      7. Generating a Build Number
      8. Preparing a Release
      9. The Shortlog
    4. Summary
  9. GitHub
    1. Account Setup and Configuration
      1. SSH Access
      2. Your Avatar
      3. Your Email Addresses
      4. Two Factor Authentication
    2. Contributing to a Project
      1. Forking Projects
      2. The GitHub Flow
      3. Advanced Pull Requests
      4. Markdown
    3. Maintaining a Project
      1. Creating a New Repository
      2. Adding Collaborators
      3. Managing Pull Requests
      4. Mentions and Notifications
      5. Special Files
      6. README
      7. CONTRIBUTING
      8. Project Administration
    4. Managing an organization
      1. Organization Basics
      2. Teams
      3. Audit Log
    5. Scripting GitHub
      1. Hooks
      2. The GitHub API
      3. Basic Usage
      4. Commenting on an Issue
      5. Changing the Status of a Pull Request
      6. Octokit
    6. Summary
  10. Git Tools
    1. Revision Selection
      1. Single Revisions
      2. Short SHA-1
      3. Branch References
      4. RefLog Shortnames
      5. Ancestry References
      6. Commit Ranges
    2. Interactive Staging
      1. Staging and Unstaging Files
      2. Staging Patches
    3. Stashing and Cleaning
      1. Stashing Your Work
      2. Creative Stashing
      3. Creating a Branch from a Stash
      4. Cleaning your Working Directory
    4. Signing Your Work
      1. GPG Introduction
      2. Signing Tags
      3. Verifying Tags
      4. Signing Commits
      5. Everyone Must Sign
    5. Searching
      1. Git Grep
      2. Git Log Searching
    6. Rewriting History
      1. Changing the Last Commit
      2. Changing Multiple Commit Messages
      3. Reordering Commits
      4. Squashing Commits
      5. Splitting a Commit
      6. The Nuclear Option: filter-branch
    7. Reset Demystified
      1. The Three Trees
      2. The Workflow
      3. The Role of Reset
      4. Reset With a Path
      5. Squashing
      6. Check It Out
      7. Summary
    8. Advanced Merging
      1. Merge Conflicts
      2. Undoing Merges
      3. Other Types of Merges
    9. Rerere
    10. Debugging with Git
      1. File Annotation
      2. Binary Search
    11. Submodules
      1. Starting with Submodules
      2. Cloning a Project with Submodules
      3. Working on a Project with Submodules
      4. Submodule Tips
      5. Issues with Submodules
    12. Bundling
    13. Replace
    14. Credential Storage
      1. Under the Hood
      2. A Custom Credential Cache
    15. Summary
  11. Customizing Git
    1. Git Configuration
      1. Basic Client Configuration
      2. Colors in Git
      3. External Merge and Diff Tools
      4. Formatting and Whitespace
      5. Server Configuration
    2. Git Attributes
      1. Binary Files
      2. Keyword Expansion
      3. Exporting Your Repository
      4. Merge Strategies
    3. Git Hooks
      1. Installing a Hook
      2. Client-Side Hooks
      3. Server-Side Hooks
    4. An Example Git-Enforced Policy
      1. Server-Side Hook
      2. Client-Side Hooks
    5. Summary
  12. Git and Other Systems
    1. Git as a Client
      1. Git and Subversion
      2. Git and Mercurial
      3. Git and Perforce
      4. Git and TFS
    2. Migrating to Git
      1. Subversion
      2. Mercurial
      3. Perforce
      4. TFS
      5. A Custom Importer
    3. Summary
  13. Git Internals
    1. Plumbing and Porcelain
    2. Git Objects
      1. Tree Objects
      2. Commit Objects
      3. Object Storage
    3. Git References
      1. The HEAD
      2. Tags
      3. Remotes
    4. Packfiles
    5. The Refspec
      1. Pushing Refspecs
      2. Deleting References
    6. Transfer Protocols
      1. The Dumb Protocol
      2. The Smart Protocol
      3. Protocols Summary
    7. Maintenance and Data Recovery
      1. Maintenance
      2. Data Recovery
      3. Removing Objects
    8. Environment Variables
      1. Global Behavior
      2. Repository Locations
      3. Pathspecs
      4. Committing
      5. Networking
      6. Diffing and Merging
      7. Debugging
      8. Miscellaneous
    9. Summary
  14. Git in Other Environments
    1. Graphical Interfaces
      1. gitk and git-gui
      2. GitHub for Mac and Windows
      3. Other GUIs
    2. Git in Visual Studio
    3. Git in Eclipse
    4. Git in Bash
    5. Git in Zsh
    6. Git in Powershell
    7. Summary
  15. Embedding Git in your Applications
    1. Command-line Git
    2. Libgit2
      1. Advanced Functionality
      2. Other Bindings
      3. Further Reading
    3. JGit
      1. Getting Set Up
      2. Plumbing
      3. Porcelain
      4. Further Reading
  16. Git Commands
    1. Setup and Config
      1. git config
      2. git help
    2. Getting and Creating Projects
      1. git init
      2. git clone
    3. Basic Snapshotting
      1. git add
      2. git status
      3. git diff
      4. git difftool
      5. git commit
      6. git reset
      7. git rm
      8. git mv
      9. git clean
    4. Branching and Merging
      1. git branch
      2. git checkout
      3. git merge
      4. git mergetool
      5. git log
      6. git stash
      7. git tag
    5. Sharing and Updating Projects
      1. git fetch
      2. git pull
      3. git push
      4. git remote
      5. git archive
      6. git submodule
    6. Inspection and Comparison
      1. git show
      2. git shortlog
      3. git describe
    7. Debugging
      1. git bisect
      2. git blame
      3. git grep
    8. Patching
      1. git cherry-pick
      2. git rebase
      3. git revert
    9. Email
      1. git apply
      2. git am
      3. git format-patch
      4. git imap-send
      5. git send-email
      6. git request-pull
    10. External Systems
      1. git svn
      2. git fast-import
    11. Administration
      1. git gc
      2. git fsck
      3. git reflog
      4. git filter-branch
    12. Plumbing Commands
  17. Index