Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Track, branch, merge, and manage code revisions with Git, the free and open source distributed version control system. Through a series of step-by-step tutorials, this practical guide quickly takes you from Git fundamentals to advanced techniques, and provides friendly yet rigorous advice for navigating Git's many functions. You'll learn how to work with everything from small to very large projects with speed and efficiency. In this third edition, authors Prem Kumar Ponuthorai and Jon Loeliger break down Git concepts using a modular approach. You'll start with the basics and fundamental philosophy of Git, followed by intermediate commands to help you efficiently supplement your daily development workflow. Finally, you'll learn advanced Git commands and concepts to understand how Git works under the hood. • Learn how to use Git for real-world development scenarios • Gain insight into Git's common use cases, initial tasks, and basic functions • Use the system for distributed version control • Learn how to manage merges, conflicts, patches, and diffs • Apply advanced techniques such as rebasing, hooks, and ways to handle submodules

Author(s): Prem Ponuthorai, Jon Loeliger
Edition: 3
Publisher: O'Reilly Media
Year: 2022

Language: English
Commentary: Publisher's PDF
Pages: 546
City: Sebastopol, CA
Tags: Command Line; GitHub; Git; Version Control Systems; Elementary

Cover
Copyright
Table of Contents
Preface
Who This Book Is For
Essential Know-How
New in This Revision
Navigating the Book
Installing Git
A Note on Inclusive Language
Omissions
Conventions Used in This Book
O’Reilly Online Learning
How to Contact Us
Acknowledgments
Attributions
Part I. Thinking in Git
Chapter 1. Introduction to Git
Git Components
Git Characteristics
The Git Command Line
Quick Introduction to Using Git
Preparing to Work with Git
Working with a Local Repository
Working with a Shared Repository
Configuration Files
Summary
Chapter 2. Foundational Concepts
Repositories
Git Object Store
Index
Content-Addressable Database
Git Tracks Content
Pathname Versus Content
Packfiles
Visualizing the Git Object Store
Git Internals: Concepts at Work
Inside the .git Directory
Blob Objects and Hashes
Tree Object and Files
A Note on Git’s Use of SHA1
Tree Hierarchies
Commit Objects
Tag Objects
Summary
Part II. Fundamentals of Git
Chapter 3. Branches
Motivation for Using Branches in Git
Branching Guidelines
Branch Names
Dos and Don’ts in Branch Names
Managing Branches
Working in Branches
Creating Branches
Listing Branch Names
Viewing Branches and Their Commits
Switching (Checking Out) Branches
Merging Changes into a Different Branch
Creating and Checking Out a New Branch
Detached HEAD
Deleting Branches
Summary
Chapter 4. Commits
Commits: Recorded Units of Change
Atomic Changesets
Identifying Commits
Absolute Commit Names
Refs and Symrefs
Relative Commit Names
Commit History
Viewing Old Commits
Commit Graphs
Commit Ranges
Summary
Chapter 5. File Management and the Index
Importance of the Index
File Classifications in Git
Using git add
Notes on Using git commit
Using git commit --all
Writing Commit Log Messages
Using git rm
Using git mv
A Note on Tracking Renames
The .gitignore File
Summary
Chapter 6. Merges
Merge: A Technical View
Merge Examples
Preparing for a Merge
Merging Two Branches
A Merge with a Conflict
Working with Merge Conflicts
Locating Conflicted Files
Inspecting Conflicts
How Git Keeps Track of Conflicts
Finishing Up a Conflict Resolution
Aborting or Restarting a Merge
Merge Strategies
Degenerate Merges
Normal Merges
Specialty Merges
Applying Merge Strategies
Merge Drivers
How Git Thinks About Merges
Merges and Git’s Object Model
Squash Merges
Why Not Just Merge Each Change One by One?
Summary
Chapter 7. Diffs
Forms of the git diff Command
Simple git diff Example
Understanding the git diff Output
git diff and Commit Ranges
git diff with Path Limiting
How Git Derives diffs
Summary
Part III. Intermediate Skills
Chapter 8. Finding Commits
Using git bisect
Using git blame
Using Pickaxe
Summary
Chapter 9. Altering Commits
Philosophy of Altering Commit History
Caution About Altering History
Using git revert
Changing the HEAD Commit
Using git reset
Using git cherry-pick
reset, revert, and checkout
Rebasing Commits
Using git rebase -i
rebase Versus merge
Summary
Chapter 10. The Stash and the Reflog
The Stash
Use Case: Interrupted Workflow
Use Case: Updating Local Work in Progress with Upstream Changes
Use Case: Converting Stashed Changes Into a Branch
The Reflog
Summary
Chapter 11. Remote Repositories
Part I: Repository Concepts
Bare and Development Repositories
Repository Clones
Remotes
Tracking Branches
Referencing Other Repositories
Referring to Remote Repositories
The refspec
Part II: Example Using Remote Repositories
Creating an Authoritative Repository
Make Your Own Origin Remote
Developing in Your Repository
Pushing Your Changes
Adding a New Developer
Getting Repository Updates
Part III: Remote Repository Development Cycle in Pictures
Cloning a Repository
Alternate Histories
Non-Fast-Forward Pushes
Fetching the Alternate History
Merging Histories
Merge Conflicts
Pushing a Merged History
Part IV: Remote Configuration
Using git remote
Using git config
Using Manual Editing
Part V: Working with Tracking Branches
Creating Tracking Branches
Ahead and Behind
Adding and Deleting Remote Branches
Bare Repositories and git push
Summary
Chapter 12. Repository Management
Publishing Repositories
Repositories with Controlled Access
Repositories with Anonymous Read Access
Repositories with Anonymous Write Access
Repository Publishing Advice
Repository Structure
Shared Repository Structure
Distributed Repository Structure
Living with Distributed Development
Changing Public History
Separate Commit and Publish Steps
No One True History
Knowing Your Place
Upstream and Downstream Flows
The Maintainer and Developer Roles
Maintainer–Developer Interaction
Role Duality
Working with Multiple Repositories
Your Own Workspace
Where to Start Your Repository
Converting to a Different Upstream Repository
Using Multiple Upstream Repositories
Forking Projects
Summary
Part IV. Advanced Skills
Chapter 13. Patches
Why Use Patches?
Generating Patches
Patches and Topological Sorts
Mailing Patches
Applying Patches
Bad Patches
Patching Versus Merging
Summary
Chapter 14. Hooks
Types of Hooks
A Note on Using Hooks
Installing Hooks
Example Hooks
Creating Your First Hook
Available Hooks
Commit-Related Hooks
Patch-Related Hooks
Push-Related Hooks
Other Local Repository Hooks
To Hook or Not
Summary
Chapter 15. Submodules
Gitlinks
Submodules
Why Submodules?
Working with Submodules
Submodules and Credential Reuse
Git Subtrees
Adding a Subproject
Pulling Subproject Updates
Changing the Subproject from Within the Superproject
Git Submodule and Subtree Visual Comparison
Summary
Chapter 16. Advanced Manipulations
Interactive Hunk Staging
Loving git rev-list
Date-Based Checkout
Retrieve an Old Version of a File
Recovering a Lost Commit
The git fsck Command
Reconnecting a Lost Commit
Using git filter-repo
Examples Using git filter-repo
Summary
Part V. Tips and Tricks
Chapter 17. Tips, Tricks, and Techniques
Interactive Rebase with a Dirty Working Directory
Garbage Collection
Tips for Recovering Commits
Recovering from an Upstream Rebase
Quick Overview of Changes
Cleaning Up
Using git-grep to Search a Repository
Updating and Deleting refs
Following Files That Moved
Have You Been Here Before?
Migrating to Git
Migrating from a Git Version Control System
Migrating from a Non-Git Version Control System
A Note on Working with Large Repositories
Git LFS
Repository Before Git LFS and After Git LFS
Installing Git LFS
Tracking Large Objects with Git LFS
Useful Git LFS Techniques
Converting Existing Repositories to Use Git LFS
Summary
Chapter 18. Git and GitHub
About GitHub
Types of GitHub Accounts
GitHub in the Git Ecosystem
Hosting a Repository in GitHub
Repository View
Code
Issues
Pull Requests
The GitHub Flow
Resolving Merge Conflicts in GitHub
Development Workflows
Integrating with GitHub
Summary
Appendix A. History of Git
The Birth of Git
Precedents
Timeline
What’s in a Name?
Appendix B. Installing Git
Using Linux Binary Distributions
Debian/Ubuntu
Other Binary Distributions
Installing Git on macOS
Installing Git on Windows
Obtaining a Source Release
Building and Installing from Source Release
Index
About the Author
Colophon