Pro Git, 2nd Edition is your fully-updated guide to Git and its usage in the modern world. Git has come a long way since it was first developed by Linus Torvalds for Linux kernel development. It has taken the open source world by storm since its inception in 2005, and this book teaches you how to use it like a pro.
Effective and well-implemented version control is a necessity for successful web projects, whether large or small. With this book you’ll learn how to master the world of distributed version workflow, use the distributed features of Git to the full, and extend Git to meet your every need.
Written by Git pros Scott Chacon and Ben Straub, Pro Git, 2nd Edition builds on the hugely successful first edition, and is now fully updated for Git version 2.0, as well as including an indispensable chapter on GitHub. It’s the best book for all your Git needs.
Conditions of Use
This book is licensed under a Creative Commons License (CC BY-NC-SA). You can download the ebook Pro Git, 2nd Edition for free.
- Title
- Pro Git, 2nd Edition
- Publisher
- Apress
- Author(s)
- Ben Straub, Scott Chacon
- Published
- 2014-11-09
- Edition
- 2
- Format
- eBook (pdf, epub, mobi)
- Pages
- 441
- Language
- English
- ISBN-10
- 1484200772
- ISBN-13
- 9781484200773
- License
- CC BY-NC-SA
- Book Homepage
- Free eBook, Errata, Code, Solutions, etc.
Contents at a Glance Contents About the Authors Preface by Scott Chacon Preface by Ben Straub Chapter 1: Getting Started About Version Control Local Version Control Systems Centralized Version Control Systems Distributed Version Control Systems A Short History of Git Git Basics Snapshots, Not Differences Nearly Every Operation Is Local Git Has Integrity Git Generally Only Adds Data The Three States The Command Line Installing Git Installing on Linux Installing on Mac Installing on Windows First-Time Git Setup Your Identity Your Editor Checking Your Settings Getting Help Summary Chapter 2: Git Basics Getting a Git Repository Initializing a Repository in an Existing Directory Cloning an Existing Repository Recording Changes to the Repository Checking the Status of Your Files Tracking New Files Staging Modified Files Short Status Ignoring Files Viewing Your Staged and Unstaged Changes Committing Your Changes Skipping the Staging Area Removing Files Moving Files Viewing the Commit History Limiting Log Output Undoing Things Unstaging a Staged File Unmodifying a Modified File Working with Remotes Showing Your Remotes Adding Remote Repositories Fetching and Pulling from Your Remotes Pushing to Your Remotes Inspecting a Remote Removing and Renaming Remotes Tagging Listing Your Tags Creating Tags Annotated Tags Lightweight Tags Tagging Later Sharing Tags Git Aliases Summary Chapter 3: Git Branching Branching in a Nutshell Creating a New Branch Switching Branches Basic Branching and Merging Basic Branching Basic Merging Basic Merge Conflicts Branch Management Branching Workflows Long-Running Branches Topic Branches Remote Branches Pushing Tracking Branches Pulling Deleting Remote Branches Rebasing The Basic Rebase More Interesting Rebases The Perils of Rebasing Rebase When You Rebase Rebase vs. Merge Summary Chapter 4: Git on the Server The Protocols Local Protocol The Pros The Cons The HTTP Protocols Smart HTTP Dumb HTTP The Pros The Cons The SSH Protocol The Pros The Cons The Git Protocol The Pros The Cons Getting Git on a Server Putting the Bare Repository on a Server Small Setups SSH Access Generating Your SSH Public Key Setting Up the Server Git Daemon Smart HTTP GitWeb GitLab Installation Administration Users Groups Projects Hooks Basic Usage Working Together Third Party Hosted Options Summary Chapter 5: Distributed Git Distributed Workflows Centralized Workflow Integration-Manager Workflow Dictator and Lieutenants Workflow Workf lows Summary Contributing to a Project Commit Guidelines Private Small Team Private Managed Team Public Project, Fork Public Project, E-Mail Summary Maintaining a Project Working in Topic Branches Applying Patches from E-mail Applying a Patch with apply Applying a Patch with am Checking Out Remote Branches Determining What Is Introduced Integrating Contributed Work Merging Workflows Large-Merging Workflows Rebasing and Cherry Picking Workflows Rerere Tagging Your Releases Generating a Build Number Preparing a Release The Shortlog Summary Chapter 6: Github Account Setup and Configuration SSH Access Your Avatar Your Email Addresses Two-Factor Authentication Contributing to a Project Forking Projects The GitHub Flow Creating a Pull Request Iterating on a Pull Request Advanced Pull Requests Pull Requests as Patches Keeping up with Upstream References Markdown GitHub Flavored Markdown Task Lists Code Snippets Quoting Emoji Images Maintaining a Project Creating a New Repository Adding Collaborators Managing Pull Requests Email Notifications Collaborating on the Pull Request Pull Request Refs Pull Requests on Pull Requests Mentions and Notifications The Notifications Page Web Notifications Email Notifications Special Files README CONTRIBUTING Project Administration Changing the Default Branch Transferring a Project Managing an Organization Organization Basics Teams Audit Log Scripting GitHub Hooks Services Hooks The GitHub API Basic Usage Commenting on an Issue Changing the Status of a Pull Request Octokit Summary Chapter 7: Git Tools Revision Selection Single Revisions Short SHA Branch References Ref Log Shortnames Ancestry References Commit Ranges Double Dot Multiple Points Triple Dot Interactive Staging Staging and Unstaging Files Staging Patches Stashing and Cleaning Stashing Your Work Creative Stashing Unapplying a Stash Creating a Branch from a Stash Cleaning Your Working Directory Signing Your Work GPG Introduction Signing Tags Verifying Tags Signing Commits Everyone Must Sign Searching Git Grep Git Log Searching Line Log Search Rewriting History Changing the Last Commit Changing Multiple Commit Messages Reordering Commits Squashing a Commit Splitting a Commit The Nuclear Option: filter-branch Removing a File from Every Commit Making a Subdirectory the New Root Changing E-Mail Addresses Globally Reset Demystified The Three Trees The HEAD The Index The Working Directory The Workflow The Role of Reset Step 1: Move HEAD Step 2: Updating the Index (--mixed) Step 3: Updating the Working Directory (--hard) Recap Reset with a Path Squashing Check It Out Without Paths With Paths Summary Advanced Merging Merge Conflicts Aborting a Merge Ignoring Whitespace Manual File Re-merging Checking Out Conflicts Merge Log Combined Diff Format Undoing Merges Fix the References Reverse the Commit Other Types of Merges Our or Theirs Preference Subtree Merging Rerere Debugging with Git File Annotation Binary Search Submodules Starting with Submodules Cloning a Project with Submodules Working on a Project with Submodules Pulling in Upstream Changes Working on a Submodule Publishing Submodule Changes Merging Submodule Changes Submodule Tips Submodule Foreach Useful Aliases Issues with Submodules Aborting Bundling Replace Credential Storage Under the Hood A Custom Credential Cache Summary Chapter 8: Customizing Git Git Configuration Basic Client Configuration core.editor commit.template core.pager user.signingkey core.excludesfile help.autocorrect Colors in Git color.ui color.* External Merge and Diff Tools Formatting and Whitespace core.autocrlf core.whitespace Server Configuration receive.fsckObjects receive.denyNonFastForwards receive.denyDeletes Git Attributes Binary Files Identifying Binary Files Diffing Binary Files Keyword Expansion Exporting Your Repository export-ignore export-subst Merge Strategies Git Hooks Installing a Hook Client-Side Hooks Committing-Workflow Hooks E-mail Workflow Hooks Other Client Hooks Server-Side Hooks pre-receive update post-receive An Example Git-Enforced Policy Server-Side Hook Enforcing a Specific Commit-Message Format Enforcing a User-Based ACL System Testing It Out Client-Side Hooks Summary Chapter 9: Git and Other Systems Git as a Client Git and Subversion git svn Setting Up Getting Started Committing Back to Subversion Pulling in New Changes Git Branching Issues Subversion Branching Creating a New SVN Branch Switching Active Branches Subversion Commands SVN Style History SVN Annotation SVN Server Information Ignoring What Subversion Ignores Git-Svn Summary Git and Mercurial Getting Started Workflow Branches and Bookmarks Mercurial Summary Git and Perforce Git Fusion Setting Up Fusion Configuration Workflow Git-Fusion Summary Git-p4 Setting Up Getting Started Workflow Branching Git and Perforce Summary Git and TFS Which Tool? Getting Started: git-tf Getting Started: git-tfs Git-tf[s] Workflow Workflow: git-tf Workflow: git-tfs Git and TFS Summary Migrating to Git Subversion Mercurial Perforce Perforce Git Fusion A Custom Importer Summary Chapter 10: Git Internals Plumbing and Porcelain Git Objects Tree Objects Commit Objects Object Storage Git References The HEAD Tags Remotes Packfiles The Refspec Pushing Refspecs Deleting References Transfer Protocols The Dumb Protocol The Smart Protocol Uploading Data SSH HTTP(S) Downloading Data SSH HTTP(S) Protocols Summary Maintenance and Data Recovery Maintenance Data Recovery Removing Objects Environment Variables Global Behavior Repository Locations Pathspecs Committing Networking Diffing and Merging Debugging Miscellaneous Summary Appendix A: Git in Other Environments Graphical Interfaces gitk and git-gui GitHub for Mac and Windows Installation Recommended Workflow Summary Other GUIs Git in Visual Studio Git in Eclipse Git in Bash Git in Zsh Git in Powershell Summary Appendix B: Embedded Git in Your Applications Command-line Git Libgit2 Advanced Functionality Other Bindings LibGit2Sharp objective-git pygit2 Further Reading Appendix C: Git Commands Setup and Config git config git help Getting and Creating Projects git init git clone Basic Snapshotting git add git status git diff git difftool git commit git reset git rm git mv git clean Branching and Merging git branch git checkout git merge git mergetool git log git stash git tag Sharing and Updating Projects git fetch git pull git push git remote git archive git submodule Inspection and Comparison git show git shortlog git describe Debugging git bisect git blame git grep Patching git cherry-pick git rebase git revert Email git apply git am git format-patch git send-email git request-pull External Systems git svn git fast-import Administration git gc git fsck git reflog git filter-branch Plumbing Commands Index