You are previewing Pro Git.

Pro Git

Cover of Pro Git by Scott Chacon Published by Apress
  1. Copyright
  2. Foreword
  3. About the Author
  4. About the Technical Reviewer
  5. Acknowledgments
  6. Introduction
  7. 1. Getting Started
    1. 1.1. About Version Control
    2. 1.2. Local Version Control Systems
    3. 1.3. Centralized Version Control Systems
    4. 1.4. Distributed Version Control Systems
    5. 1.5. A Short History of Git
    6. 1.6. Git Basics
      1. 1.6.1. Snapshots, Not Differences
      2. 1.6.2. Nearly Every Operation Is Local
      3. 1.6.3. Git Has Integrity
      4. 1.6.4. Git Generally Only Adds Data
      5. 1.6.5. The Three States
    7. 1.7. Installing Git
      1. 1.7.1. Installing from Source
      2. 1.7.2. Installing on Linux
      3. 1.7.3. Installing on Mac
      4. 1.7.4. Installing on Windows
    8. 1.8. First-Time Git Setup
      1. 1.8.1. Your Identity
      2. 1.8.2. Your Editor
      3. 1.8.3. Your Diff Tool
      4. 1.8.4. Checking Your Settings
    9. 1.9. Getting Help
    10. 1.10. Summary
  8. 2. Git Basics
    1. 2.1. Getting a Git Repository
      1. 2.1.1. Initializing a Repository in an Existing Directory
      2. 2.1.2. Cloning an Existing Repository
    2. 2.2. Recording Changes to the Repository
      1. 2.2.1. Checking the Status of Your Files
      2. 2.2.2. Tracking New Files
      3. 2.2.3. Staging Modified Files
      4. 2.2.4. Ignoring Files
      5. 2.2.5. Viewing Your Staged and Unstaged Changes
      6. 2.2.6. Committing Your Changes
      7. 2.2.7. Skipping the Staging Area
      8. 2.2.8. Removing Files
      9. 2.2.9. Moving Files
    3. 2.3. Viewing the Commit History
      1. 2.3.1. Limiting Log Output
      2. 2.3.2. Using a GUI to Visualize History
    4. 2.4. Undoing Things
      1. 2.4.1. Changing Your Last Commit
      2. 2.4.2. Unstaging a Staged File
      3. 2.4.3. Unmodifying a Modified File
    5. 2.5. Working with Remotes
      1. 2.5.1. Showing Your Remotes
      2. 2.5.2. Adding Remote Repositories
      3. 2.5.3. Fetching and Pulling from Your Remotes
      4. 2.5.4. Pushing to Your Remotes
      5. 2.5.5. Inspecting a Remote
      6. 2.5.6. Removing and Renaming Remotes
    6. 2.6. Tagging
      1. 2.6.1. Listing Your Tags
      2. 2.6.2. Creating Tags
      3. 2.6.3. Verifying Tags
      4. 2.6.4. Tagging Later
      5. 2.6.5. Sharing Tags
    7. 2.7. Tips and Tricks
      1. 2.7.1. Auto-Completion
      2. 2.7.2. Git Aliases
    8. 2.8. Summary
  9. 3. Git Branching
    1. 3.1. What a Branch Is
    2. 3.2. Basic Branching and Merging
      1. 3.2.1. Basic Branching
      2. 3.2.2. Basic Merging
      3. 3.2.3. Basic Merge Conflicts
    3. 3.3. Branch Management
    4. 3.4. Branching Workflows
      1. 3.4.1. Long-Running Branches
      2. 3.4.2. Topic Branches
    5. 3.5. Remote Branches
      1. 3.5.1. Pushing
      2. 3.5.2. Tracking Branches
      3. 3.5.3. Deleting Remote Branches
    6. 3.6. Rebasing
      1. 3.6.1. The Basic Rebase
      2. 3.6.2. More Interesting Rebases
      3. 3.6.3. The Perils of Rebasing
    7. 3.7. Summary
  10. 4. Git on the Server
    1. 4.1. The Protocols
      1. 4.1.1. Local Protocol
      2. 4.1.2. The SSH Protocol
      3. 4.1.3. The Git Protocol
      4. 4.1.4. The HTTP/S Protocol
    2. 4.2. Getting Git on a Server
      1. 4.2.1. Putting the Bare Repository on a Server
    3. 4.3. Small Setups
      1. 4.3.1. SSH Access
      2. 4.3.2. Generating Your SSH Public Key
      3. 4.3.3. Setting Up the Server
      4. 4.3.4. Public Access
      5. 4.3.5. GitWeb
    4. 4.4. Gitosis
      1. 4.4.1. Git Daemon
    5. 4.5. Hosted Git
      1. 4.5.1. GitHub
      2. 4.5.2. Setting Up a User Account
      3. 4.5.3. Creating a New Repository
      4. 4.5.4. Importing from Subversion
      5. 4.5.5. Adding Collaborators
      6. 4.5.6. Your Project
      7. 4.5.7. Forking Projects
      8. 4.5.8. GitHub Summary
    6. 4.6. Summary
  11. 5. Distributed Git
    1. 5.1. Distributed Workflows
      1. 5.1.1. Centralized Workflow
      2. 5.1.2. Integration-Manager Workflow
      3. 5.1.3. Dictator and Lieutenants Workflow
    2. 5.2. Contributing to a Project
      1. 5.2.1. Commit Guidelines
      2. 5.2.2. Private Small Team
      3. 5.2.3. Private Managed Team
      4. 5.2.4. Public Small Project
      5. 5.2.5. Public Large Project
      6. 5.2.6. Summary
    3. 5.3. Maintaining a Project
      1. 5.3.1. Working in Topic Branches
      2. 5.3.2. Applying Patches from E-mail
      3. 5.3.3. Checking Out Remote Branches
      4. 5.3.4. Determining What Is Introduced
      5. 5.3.5. Integrating Contributed Work
      6. 5.3.6. Tagging Your Releases
      7. 5.3.7. Generating a Build Number
      8. 5.3.8. Preparing a Release
      9. 5.3.9. The Shortlog
    4. 5.4. Summary
  12. 6. Git Tools
    1. 6.1. Revision Selection
      1. 6.1.1. Single Revisions
      2. 6.1.2. Commit Ranges
    2. 6.2. Interactive Staging
      1. 6.2.1.
    3. 6.3. Stashing
      1. 6.3.1. Stashing Your Work
      2. 6.3.2. Creating a Branch from a Stash
    4. 6.4. Rewriting History
      1. 6.4.1. Changing the Last Commit
      2. 6.4.2. Changing Multiple Commit Messages
      3. 6.4.3. Reordering Commits
      4. 6.4.4. Squashing a Commit
      5. 6.4.5. Splitting a Commit
      6. 6.4.6. The Nuclear Option: filter-branch
    5. 6.5. Debugging with Git
      1. 6.5.1. File Annotation
      2. 6.5.2. Binary Search
    6. 6.6. Submodules
      1. 6.6.1. Starting with Submodules
      2. 6.6.2. Cloning a Project with Submodules
      3. 6.6.3. Superprojects
      4. 6.6.4. Issues with Submodules
    7. 6.7. Subtree Merging
    8. 6.8. Summary
  13. 7. Customizing Git
    1. 7.1. Git Configuration
      1. 7.1.1. Basic Client Configuration
      2. 7.1.2. Colors in Git
      3. 7.1.3. External Merge and Diff Tools
      4. 7.1.4. Formatting and Whitespace
      5. 7.1.5. Server Configuration
    2. 7.2. Git Attributes
      1. 7.2.1. Binary Files
      2. 7.2.2. Keyword Expansion
      3. 7.2.3. Exporting Your Repository
      4. 7.2.4. Merge Strategies
    3. 7.3. Git Hooks
      1. 7.3.1. Installing a Hook
      2. 7.3.2. Client-Side Hooks
      3. 7.3.3. Server-Side Hooks
    4. 7.4. An Example Git-Enforced Policy
      1. 7.4.1. Server-Side Hook
      2. 7.4.2. Client-Side Hooks
    5. 7.5. Summary
  14. 8. Git and Other Systems
    1. 8.1. Git and Subversion
      1. 8.1.1. git svn
      2. 8.1.2. Setting Up
      3. 8.1.3. Getting Started
      4. 8.1.4. Committing Back to Subversion
      5. 8.1.5. Pulling in New Changes
      6. 8.1.6. Git Branching Issues
      7. 8.1.7. Subversion Branching
      8. 8.1.8. Subversion Commands
      9. 8.1.9. SVN Server Information
      10. 8.1.10. Git-Svn Summary
    2. 8.2. Migrating to Git
      1. 8.2.1. Importing
      2. 8.2.2. Perforce
      3. 8.2.3. A Custom Importer
      4. 8.2.4. Summary
  15. 9. Git Internals
    1. 9.1. Plumbing and Porcelain
    2. 9.2. Git Objects
      1. 9.2.1. Tree Objects
      2. 9.2.2. Commit Objects
      3. 9.2.3. Object Storage
    3. 9.3. Git References
      1. 9.3.1. The HEAD
      2. 9.3.2. Tags
      3. 9.3.3. Remotes
    4. 9.4. Packfiles
      1. 9.4.1. The Refspec
      2. 9.4.2. Pushing Refspecs
      3. 9.4.3. Deleting References
    5. 9.5. Transfer Protocols
      1. 9.5.1. The Dumb Protocol
      2. 9.5.2. The Smart Protocol
      3. 9.5.3. Downloading Data
    6. 9.6. Maintenance and Data Recovery
      1. 9.6.1. Maintenance
      2. 9.6.2. Data Recovery
      3. 9.6.3. Removing Objects
    7. 9.7. Summary
  16. A. Creative Commons Legal Code
    1. A.1. Attribution-NonCommercial-ShareAlike 3.0 Unported
    2. A.2. License
    3. A.3. Creative Commons Notice
O'Reilly logo

Chapter 8. Git and Other Systems

The world isn't perfect. Usually, you can't immediately switch every project you come in contact with to Git. Sometimes you're stuck on a project using another VCS, and many times that system is Subversion. You'll spend the first part of this chapter learning about git svn, the bidirectional Subversion gateway tool in Git.

At some point, you may want to convert your existing project to Git. The second part of this chapter covers how to migrate your project into Git: first from Subversion, then from Perforce, and finally via a custom import script for a nonstandard importing case.

Git and Subversion

Currently, the majority of open source development projects and a large number of corporate projects use Subversion to ...

The best content for your career. Discover unlimited learning on demand for around $1/day.