Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Version Control with Git
Preface
Audience
Assumed Framework
Book Layout and Omissions
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
1. Introduction
Background
The Birth of Git
Precedents
Time Line
What’s in a Name?
2. Installing Git
Using Linux Binary Distributions
Debian/Ubuntu
Other Binary Distributions
Obtaining a Source Release
Building and Installing
Installing Git on Windows
Installing the Cygwin Git Package
Installing Standalone Git (msysGit)
3. Getting Started
The Git Command Line
Quick Introduction to Using Git
Creating an Initial Repository
Adding a File to Your Repository
Configuring the Commit Author
Making Another Commit
Viewing Your Commits
Viewing Commit Differences
Removing and Renaming Files in Your Repository
Making a Copy of Your Repository
Configuration Files
Configuring an Alias
Inquiry
4. Basic Git Concepts
Basic Concepts
Repositories
Git Object Types
Index
Content-Addressable Names
Git Tracks Content
Pathname Versus Content
Object Store Pictures
Git Concepts at Work
Inside the .git directory
Objects, Hashes, and Blobs
Files and Trees
A Note on Git’s Use of SHA1
Tree Hierarchies
Commits
Tags
5. File Management and the Index
It’s All About the Index
File Classifications in Git
Using git add
Some 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
A Detailed View of Git’s Object Model and Files
6. Commits
Atomic Changesets
Identifying Commits
Absolute Commit Names
refs and symrefs
Relative Commit Names
Commit History
Viewing Old Commits
Commit Graphs
Using gitk to view the commit graph
Commit Ranges
Finding Commits
Using git bisect
Using git blame
Using Pickaxe
7. Branches
Reasons for Using Branches
Branch Names
Dos and Don’ts in Branch Names
Using Branches
Creating Branches
Listing Branch Names
Viewing Branches
Checking Out Branches
A Basic Example of Checking Out a Branch
Checking Out When You Have Uncommitted Changes
Merging Changes into a Different Branch
Creating and Checking Out a New Branch
Detached HEAD Branches
Deleting Branches
8. Diffs
Forms of the git diff Command
Simple git diff Example
git diff and Commit Ranges
git diff with Path Limiting
Comparing How Subversion and Git Derive diffs
9. Merges
Merge Examples
Preparing for a Merge
Merging Two Branches
A Merge with a Conflict
Working with Merge Conflicts
Locating Conflicted Files
Inspecting Conflicts
git diff with conflicts
git log with conflicts
How Git Keeps Track of Conflicts
Finishing Up a Conflict Resolution
Aborting or Restarting a Merge
Merge Strategies
Degenerate Merges
Normal Merges
Recursive merges
Octopus 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?
10. Altering Commits
Caution About Altering History
Using git reset
Using git cherry-pick
Using git revert
reset, revert, and checkout
Changing the Top Commit
Rebasing Commits
Using git rebase -i
rebase Versus merge
11. Remote Repositories
Repository Concepts
Bare and Development Repositories
Repository Clones
Remotes
Tracking Branches
Referencing Other Repositories
Referring to Remote Repositories
The refspec
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
The fetch step
The merge or rebase step
Remote Repository Operations in Pictures
Cloning a Repository
Alternate Histories
Non-Fast-Forward Pushes
Fetching the Alternate History
Merging Histories
Merge Conflicts
Pushing a Merged History
Adding and Deleting Remote Branches
Remote Configuration
git remote
git config
Manual Editing
Bare Repositories and git push
Publishing Repositories
Repositories with Controlled Access
Repositories with Anonymous Read Access
Publishing Repositories Using git-daemon
Publishing repositories using an HTTP daemon
Publishing using Git and HTTP daemons
Repositories with Anonymous Write Access
12. Repository Management
Repository Structure
The Shared Repository Structure
Distributed Repository Structure
Repository Structure Examples
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
Isn’t forking a project bad?
Reconciling forks
13. Patches
Why Use Patches?
Generating Patches
Patches and Topological Sorts
Mailing Patches
Applying Patches
Bad Patches
Patching Versus Merging
14. Hooks
Installing Hooks
Example Hooks
Creating Your First Hook
Available Hooks
Commit-Related Hooks
Patch-Related Hooks
Push-Related Hooks
Other Local Repository Hooks
15. Combining Projects
The Old Solution: Partial Checkouts
The Obvious Solution: Import the Code into Your Project
Importing Subprojects by Copying
Importing Subprojects with git pull -s subtree
Submitting Your Changes Upstream
The Automated Solution: Checking Out Subprojects Using Custom Scripts
The Native Solution: gitlinks and git submodule
gitlinks
The git submodule Command
16. Using Git with Subversion Repositories
Example: A Shallow Clone of a Single Branch
Making Your Changes in Git
Fetching Before Committing
Committing Through git svn rebase
Pushing, Pulling, Branching, and Merging with git svn
Keeping Your Commit IDs Straight
Cloning All the Branches
Sharing Your Repository
Merging Back into Subversion
How dcommit handles merges
Miscellaneous Notes on Working with Subversion
svn:ignore Versus .gitignore
Reconstructing the git-svn cache
Index
Colophon
← Prev
Back
Next →
← Prev
Back
Next →