Learning Git

Book description

This book teaches Git in a simple, visual, and tangible manner so that you can build a solid mental model of how Git version control works. Through the use of color, storytelling, and hands-on exercises, you will learn to use this tool with confidence.

The information is introduced incrementally so that you don't get bogged down with unknown terms or concepts. Learning Git is ideal for anyone who needs to use Git for personal or professional projects: coding bootcamp students, junior developers, data professionals, and technical writers, to name just a few!

This book covers how to:

  • Download Git and initialize a local repository
  • Add files to the staging area and make commits
  • Create, switch, and delete branches
  • Merge and rebase branches
  • Work with remote repositories including cloning, pushing, pulling, and fetching
  • Use pull requests to collaborate with others

Publisher resources

View/Submit Errata

Table of contents

  1. [ Preface ]
  2. Chapter 1. Git and the Command Line
    1. What Is Git?
    2. The Graphical User Interface and the Command Line
    3. Opening a Command Line Window
    4. Executing Commands in the Command Line
    5. Installing Git
    6. Command Options and Arguments
    7. Clearing the Command Line
    8. Opening the Filesystem Window
    9. Working with Directories
    10. Closing the Command Line
    11. Setting Git Configurations
    12. Preparing a Text Editor
    13. Integrated Terminals
    14. Summary
  3. Chapter 2. Local Repositories
    1. Current Setup
    2. Introducing Repositories
    3. Initializing a Local Repository
    4. The Areas of Git
    5. Adding a File to a Git Project
    6. Summary
  4. Chapter 3. Making a Commit
    1. Current Setup
    2. Why Do We Make Commits?
    3. The Two Steps to Make a Commit
    4. Viewing a List of Commits
    5. Summary
  5. Chapter 4. Branches
    1. State of the Local Repository
    2. Why Do We Use Branches?
    3. Unmodified and Modified Files
    4. Making Commits on a Branch
    5. Creating a Branch
    6. What Is HEAD?
    7. Switching Branches
    8. Working on a Separate Branch
    9. Summary
  6. Chapter 5. Merging
    1. State of the Local Repository
    2. Introducing Merging
    3. Types of Merges
    4. Doing a Fast-Forward Merge
    5. Checking Out Commits
    6. Creating a Branch and Switching onto It in One Go
    7. Summary
  7. Chapter 6. Hosting Services and Authentication
    1. Hosting Services and Remote Repositories
    2. Setting Up a Hosting Service Account
    3. Setting Up Authentication Credentials
    4. Summary
  8. Chapter 7. Creating and Pushing to a Remote Repository
    1. State of the Local Repository
    2. The Two Ways to Start Work on a Git Project
    3. The Interaction Between Local and Remote Repositories
    4. Why Do We Use Remote Repositories?
    5. Creating a Remote Repository with Data
    6. Working on a Remote Repository Directly on a Hosting Service
    7. Summary
  9. Chapter 8. Cloning and Fetching
    1. State of the Local and Remote Repositories
    2. Cloning a Remote Repository
    3. Deleting Branches
    4. Git Collaboration and Branches
    5. Incorporating Changes from the Remote Repository
    6. Deleting Branches (Continued)
    7. Summary
  10. Chapter 9. Three-Way Merges
    1. State of the Local and Remote Repositories
    2. Why Are Three-Way Merges Important?
    3. Setting Up a Three-Way Merge Scenario
    4. Defining Upstream Branches
    5. Editing the Same File Multiple Times Between Commits
    6. Working at the Same Time as Others on Different Files
    7. Three-Way Merge in Practice
    8. Pulling Changes from a Remote Repository
    9. State of the Local and Remote Repositories
    10. Summary
  11. Chapter 10. Merge Conflicts
    1. State of the Local and Remote Repositories
    2. Introducing Merge Conflicts
    3. How to Resolve Merge Conflicts
    4. Setting Up a Merge Conflict Scenario
    5. The Merge Conflict Resolution Process
    6. Resolving Merge Conflicts in Practice
    7. Staying Up to Date with a Remote Repository
    8. Syncing the Repositories
    9. State of the Local and Remote Repositories
    10. Summary
  12. Chapter 11. Rebasing
    1. State of the Local and Remote Repositories
    2. Integrating Changes in Git
    3. Why Is Rebasing Helpful?
    4. Setting Up the Rebasing Example
    5. Unstaging and Staging Files
    6. Preparing to Rebase
    7. The Five Stages of the Rebase Process
    8. Rebasing and Merge Conflicts
    9. Rebasing a Branch in Practice
    10. The Golden Rule of Rebasing
    11. Syncing the Repositories
    12. State of the Local and Remote Repositories
    13. Summary
  13. Chapter 12. Pull Requests (Merge Requests)
    1. State of the Local and Remote Repositories
    2. Introducing Pull Requests
    3. Hosting Service Specifics
    4. Why Use Pull Requests?
    5. Understanding How Pull Requests Are Merged
    6. Preparing to Make a Pull Request
    7. An Easier Way to Define Upstream Branches
    8. Creating a Pull Request on a Hosting Service
    9. Reviewing and Approving a Pull Request
    10. Merging a Pull Request
    11. Deleting Remote Branches
    12. Syncing the Local Repositories and Cleaning Up
    13. State of the Local and Remote Repositories
    14. Summary
  14. [ Epilogue ]
  15. Appendix A: Chapter Prerequisites
  16. Appendix B: Command Quick Reference
  17. Appendix C: Visual Language Reference
  18. [ Index ]

Product information

  • Title: Learning Git
  • Author(s): Anna Skoulikari
  • Release date: May 2023
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781098133917