Synopses & Reviews
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 systems flexibility. This book shows you how.
- Learn how to use Git for several real-world development scenarios
- Gain insight into Gits 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
Git permits practically an infinite variety of methods for development and collaboration, but its flexibility also means that some users don't understand how to use it to best advantage. This book offers tutorials on ways to use it, as well as friendly yet rigorous advice to help you navigate Git's many functions.
In step by step fashion, youll learn how to track, branch, merge, and manage code revisions with Git. The second edition has been thoroughly revised, with extended coverage of the reflog and stash, tips for tree munging, and tips for using the Github repository.
- Learn how to use Git in several real-world development environments
- Gain insight into Git's common-use cases, initial tasks, and basic functions
- Understand how to use Git for both centralized and distributed version control
- Use Git to manage patches, diffs, merges, and conflicts
- Acquire advanced techniques such as rebasing, hooks, and ways to handle submodules (subprojects)
- Learn how to use Git with Subversion
Git has earned the respect of developers around the world. Find out how you can benefit from this amazing tool with Version Control with Git.
About the Author
Jon Loeliger is a freelance software engineer who contributes to Open Source projects such as Linux, U-Boot, and Git. He has given tutorial presentations on Git at many conferences including Linux World, and has written several papers on Git for Linux Magazine.
In prior lives, Jon has spent a number of years developing highly optimizing compilers, router protocols, Linux porting, and the occasional game. Jon holds degrees in Computer Science from Purdue University. In his spare time, he is a home winemaker.
Matthew McCullough, Vice President of Training for GitHub.com, is an energetic 15-year veteran of enterprise software development, world-traveling open source educator, and co-founder of a US consultancy. All these activities provide him avenues of sharing success stories of leveraging Git and GitHub. Matthew is a contributing author to the Gradle and Jenkins O'Reilly books, as well as the creator of the Git Master Class series for O'Reilly. Matthew also regularly speaks on the No Fluff Just Stuff Java symposium series. He is the author of the DZone Git RefCard, and president of the Denver Open Source Users Group.
Table of Contents
Preface; Audience; Assumed Framework; Book Layout and Omissions; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Attributions; Chapter 1: Introduction; 1.1 Background; 1.2 The Birth of Git; 1.3 Precedents; 1.4 Timeline; 1.5 What's in a Name?; Chapter 2: Installing Git; 2.1 Using Linux Binary Distributions; 2.2 Obtaining a Source Release; 2.3 Building and Installing; 2.4 Installing Git on Windows; Chapter 3: Getting Started; 3.1 The Git Command Line; 3.2 Quick Introduction to Using Git; 3.3 Configuration Files; 3.4 Inquiry; Chapter 4: Basic Git Concepts; 4.1 Basic Concepts; 4.2 Object Store Pictures; 4.3 Git Concepts at Work; Chapter 5: File Management and the Index; 5.1 It's All About the Index; 5.2 File Classifications in Git; 5.3 Using git add; 5.4 Some Notes on Using git commit; 5.5 Using git rm; 5.6 Using git mv; 5.7 A Note on Tracking Renames; 5.8 The .gitignore File; 5.9 A Detailed View of Git's Object Model and Files; Chapter 6: Commits; 6.1 Atomic Changesets; 6.2 Identifying Commits; 6.3 Commit History; 6.4 Finding Commits; Chapter 7: Branches; 7.1 Reasons for Using Branches; 7.2 Branch Names; 7.3 Using Branches; 7.4 Creating Branches; 7.5 Listing Branch Names; 7.6 Viewing Branches; 7.7 Checking out Branches; 7.8 Deleting Branches; Chapter 8: Diffs; 8.1 Forms of the git diff Command; 8.2 Simple git diff Example; 8.3 git diff and Commit Ranges; 8.4 git diff with Path Limiting; 8.5 Comparing How Subversion and Git Derive diffs; Chapter 9: Merges; 9.1 Merge Examples; 9.2 Working with Merge Conflicts; 9.3 Merge Strategies; 9.4 How Git Thinks About Merges; Chapter 10: Altering Commits; 10.1 Caution About Altering History; 10.2 Using git reset; 10.3 Using git cherry-pick; 10.4 Using git revert; 10.5 reset, revert, and checkout; 10.6 Changing the Top Commit; 10.7 Rebasing Commits; Chapter 11: The Stash and the Reflog; 11.1 The Stash; 11.2 The Reflog; Chapter 12: Remote Repositories; 12.1 Repository Concepts; 12.2 Referencing Other Repositories; 12.3 Example Using Remote Repositories; 12.4 Remote Repository Development Cycle in Pictures; 12.5 Remote Configuration; 12.6 Working with Tracking Branches; 12.7 Adding and Deleting Remote Branches; 12.8 Bare Repositories and git push; Chapter 13: Repository Management; 13.1 A Word About Servers; 13.2 Publishing Repositories; 13.3 Repository Publishing Advice; 13.4 Repository Structure; 13.5 Living with Distributed Development; 13.6 Knowing Your Place; 13.7 Working with Multiple Repositories; Chapter 14: Patches; 14.1 Why Use Patches?; 14.2 Generating Patches; 14.3 Mailing Patches; 14.4 Applying Patches; 14.5 Bad Patches; 14.6 Patching Versus Merging; Chapter 15: Hooks; 15.1 Installing Hooks; 15.2 Available Hooks; Chapter 16: Combining Projects; 16.1 The Old Solution: Partial Checkouts; 16.2 The Obvious Solution: Import the Code into Your Project; 16.3 The Automated Solution: Checking out Subprojects Using Custom Scripts; 16.4 The Native Solution: gitlinks and git submodule; Chapter 17: Submodule Best Practices; 17.1 Submodule Commands; 17.2 Why Submodules?; 17.3 Submodules Preparation; 17.4 Why Read Only?; 17.5 Why Not Read Only?; 17.6 Examining the Hashes of Submodule Commits; 17.7 Credential Reuse; 17.8 Use Cases; 17.9 Multilevel Nesting of Repos; 17.10 Submodules on the Horizon; Chapter 18: Using Git with Subversion Repositories; 18.1 Example: A Shallow Clone of a Single Branch; 18.2 Pushing, Pulling, Branching, and Merging with git svn; 18.3 Miscellaneous Notes on Working with Subversion; Chapter 19: Advanced Manipulations; 19.1 Using git filter-branch; 19.2 How I Learned to Love git rev-list; 19.3 Interactive Hunk Staging; 19.4 Recovering a Lost Commit; Chapter 20: Tips, Tricks, and Techniques; 20.1 Interactive Rebase with a Dirty Working Directory; 20.2 Remove Left-Over Editor Files; 20.3 Garbage Collection; 20.4 Split a Repository; 20.5 Tips for Recovering Commits; 20.6 Subversion Conversion Tips; 20.7 Manipulating Branches from Two Repositories; 20.8 Recovering from an Upstream Rebase; 20.9 Make Your Own Git Command; 20.10 Quick Overview of Changes; 20.11 Cleaning Up; 20.12 Using git-grep to Search a Repository; 20.13 Updating and Deleting refs; 20.14 Following Files that Moved; 20.15 Keep, But Don't Track, This File; 20.16 Have You Been Here Before?; Chapter 21: Git and GitHub; 21.1 Repo for Public Code; 21.2 Creating a GitHub Repository; 21.3 Social Coding on Open Source; 21.4 Watchers; 21.5 News Feed; 21.6 Forks; 21.7 Creating Pull Requests; 21.8 Managing Pull Requests; 21.9 Notifications; 21.10 Finding Users, Projects, and Code; 21.11 Wikis; 21.12 GitHub Pages (Git for Websites); 21.13 In-Page Code Editor; 21.14 Subversion Bridge; 21.15 Tags Automatically Becoming Archives; 21.16 Organizations; 21.17 REST API; 21.18 Social Coding on Closed Source; 21.19 Eventual Open Sourcing; 21.20 Coding Models; 21.21 GitHub Enterprise; 21.22 GitHub in Sum; Colophon;