Complete Git Guide: Understand and Master Git and GitHub

Video description

Complete with practical activities, this comprehensive Git and GitHub guide will help you understand how Git works. You'll learn how to use Git features efficiently and fix issues in your development workflow.

Starting with the internal structure of a Git repository, this course will take you through the four types of Git objects: blobs, trees, commits, and annotated tags. You'll understand how each object has a unique SHA-1 hash and how all objects are stored in folders, files are stored in blobs, and filenames are stored in other Git objects called trees. You'll even get to grips with creating new Git objects without using git commit and git add. Once you've created Git objects in the Git repository, you will add it to the staging area and working directory.

By the end of this course, you'll have become a Git and GitHub expert and be able to perform basic and advanced Git tasks seamlessly.

What You Will Learn

  • Use Git in terminals as well as GUIs such as GitHub Desktop and Visual Studio Code
  • Explore different Git objects, including blobs, trees, and annotated tags
  • Create local and remote Git repositories
  • Get to grips with rebasing and merging branches
  • Discover what a pull request is and how to create it in GitHub
  • Learn advanced Git operations such as squashing, amending, and reverting commits
  • Contribute to public repositories using the forking technique

Audience

Whether you're a complete beginner or a developer with years of experience using Git, this course will add to your Git and GitHub knowledge and help enhance your skills.

About The Author

Bogdan Stashchuk: Bogdan Stashchuk is an experienced instructor (over 20+ years) with a software engineering background. He teaches complex stuff in an easy step-by-step manner. All his courses include practical exercises, which allow the learners to follow him from the start of any course till the end. Learners will perform all tasks the same way he does in his video lectures. There are a lot of challenging assignments, the solutions for which are discussed inside the course. This is the perfect combination that enables you to really learn and retain gained knowledge for a long period of time.

Table of contents

  1. Chapter 1 : Introduction to Git and GitHub
    1. Introduction
    2. Section 1 Introduction
    3. Git Versus GitHub
  2. Chapter 2 : Installation of Git and Configuration of the Shell
    1. Section 2 Introduction
    2. Installing Git on MacOS
    3. Installing Git on Windows
    4. Installing Git on Linux
    5. Installing iTerm2 on MacOS
    6. Installing Custom Z-Shell on MacOS
  3. Chapter 3 : Basic Shell Commands
    1. Section 3 Introduction
    2. Shell Commands - Directory Management
    3. Shell Commands - File Management - Part 1
    4. Shell Commands - File Management - Part 2
  4. Chapter 4 : How Git Works Under the Hood
    1. Section 4 Introduction
    2. Initializing a New Git Repository
    3. Overview of the .git Folder
    4. Git Object Types
    5. Writing a New Git Object with a git hash-object
    6. JSON Versus Git Database
    7. What is the Hash Function?
    8. Hash Function Overview
    9. SHA-1 Hash Function
    10. How Many Files can Git Store?
    11. Probability Theory in a Dice Game
    12. Git Hash Collision Probability
    13. More details on hash collision probability (OPTIONAL)
    14. Exploring Git Objects with the git cat-file Command
    15. Creating a New Git Blob Based on a File
    16. Why Git Blobs do not Store File Names
    17. Contents of Git Objects
    18. What Have We Learned so Far?
    19. Tree Objects in Git
    20. Git Object Permissions
    21. Creating a Git Tree Object
    22. (Free Preview): Examining Tree Object
    23. Working Directory, Staging Area, and Git Repository
    24. Overview of Current File Distribution
    25. Git Read-tree
    26. Reading Files in the Staging Area Using git ls-files
    27. Git Checkout-index
    28. Number of Folders Created for Objects
    29. Section Summary
  5. Chapter 5 : Basic Git Operations
    1. Section 5 Introduction
    2. What is Commit?
    3. Configuring the Git Author Name and Email
    4. Creating Your First Commit
    5. Exploring a Commit Object
    6. Project's Current State Overview
    7. Basic Git Commands
    8. Adding a New File to the Working Directory
    9. Git Files Lifecycle
    10. Stage File
    11. Unstage File using git rm
    12. Committing Changes
    13. Exploring Changes in a Git Repository
    14. Current Diagram of a Git Repository
  6. Chapter 6 : Git Branches and HEAD
    1. Section 6 Introduction
    2. Most Common Git Operations
    3. Project's Current State Overview
    4. Installing GitHub Desktop
    5. GitHub Desktop Overview
    6. What is Branch in Git?
    7. What is HEAD in Git?
    8. Third Commit
    9. Git Repository Changes after a Third Commit
    10. Checking Out a Specific Commit
    11. Why Do We Need Branches?
    12. Git Branches Management
    13. Creating a New Branch
    14. Committing Changes in the New Branch
    15. Exploring Commit in the New Branch
    16. Why Git Reuses Blobs with the Same Contents?
  7. Chapter 7 : Cloning, Exploring, and Modifying Public Repositories
    1. Section 7 Introduction
    2. Cloning Remote Repository
    3. Exploring the Contents of the Cloned Repository
    4. Unpacking Git Objects
    5. Exploring Cloned Repository in GitHub Desktop
    6. Installing the Text Editor Visual Studio Code
    7. Exploring Visual Studio Code
    8. Committing Changes in the Cloned Repository
    9. Git diff Command
    10. Overview of the Changes
  8. Chapter 8 : Merging Branches
    1. Section 8 Introduction
    2. Why Branch Merging is Needed
    3. Fast-Forward Merge
    4. Merging process
    5. Fast-Forward Merge in Action
    6. Three-Way Merge
    7. Performing a Three-Way Merge
    8. Observing a Git Repository after a Three-Way Merge
    9. Installing SourceTree
    10. SourceTree in Action
    11. What is Merge Conflict?
    12. Creating Merge Conflict
    13. Observing Conflicts in the Staging Area and Working Directory
    14. Resolving a Merge Conflict in Terminal
    15. Resolving Conflicts in Visual Studio Code
  9. Chapter 9 : GitHub and Remote Repositories
    1. Section 9 Introduction
    2. What is a Git Hosting Service?
    3. Creating a GitHub Account
    4. Exploring the First Repository in GitHub
    5. Creating Another Commit in GitHub
    6. Creating a New Branch in GitHub
    7. Making Changes in the New Branch
    8. Cloning a Remote Repository
    9. What is Remote Repository?
    10. How Remote Repository Empowers Collaboration?
  10. Chapter 10 : Git Push, Fetch, and Pull
    1. Section 10 Introduction
    2. Overview of the Push, Fetch, and Pull Git Commands
    3. What is Origin?
    4. Listing Remote and Local Branches
    5. What is Tracking Branch?
    6. Checking Out a Remote Branch
    7. Git Remote Show Origin
    8. Git Fetch in Action
    9. Git Pull Two-Step Process
    10. How to Perform Git Pull
    11. What is FETCH_HEAD?
    12. Git Pull with Fast-Forward Merge
    13. Fetching Remote Changes Manually
    14. Merging FETCH_HEAD Manually
    15. Resolving Conflicts Using Git Pull
    16. Pushing to a Remote Repository
    17. Committing Under Another Author
    18. How do Remote and Local Branches Sync?
    19. Creating a Remote Branch Based on a Local Branch
    20. Updating the Tracking Status of the Branches
    21. Removing a Remote Branch Using a Local Terminal
    22. Git Show-ref
  11. Chapter 11 : Pull Requests
    1. Section 11 Introduction
    2. Collaboration Between Contributors
    3. What is a Pull Request?
    4. Why was Pull Request Named Pull Request?
    5. Pull Request Versus Merge Request
    6. Pull Request Step-By-step
    7. Creating a New Repository in GitHub
    8. Changing the Author of the Last Commit
    9. Pushing Branch to Remote
    10. Opening a Pull Request
    11. Adding Comments and Approving a Pull Request
    12. Creating and Publishing a New Branch Using GitHub Desktop
    13. Signing into GitHub Using GitHub Desktop
    14. Creating and Merging a Pull Request
    15. Adding a New Collaborator in GitHub
    16. Exploring Your GitHub Account
    17. Opening and Merging a Pull Request Using a Collaborator
    18. Merging without Approvals
    19. Configuring a Protected Branch Rule
    20. Merging after Gaining Required Approval
    21. Exploring Pull Requests in the Public Repositories
    22. Working with Issues in GitHub
  12. Chapter 12 : Forks and Contribution to the Public Repositories
    1. Section 12 Introduction
    2. Creating a Fork
    3. Synching Changes from the Parent Repository
    4. Adding a New Upstream Remote Repository
    5. Fetching Changes from Upstream
    6. Synchronizing Changes from Upstream
    7. How to Open Pull Request from a Forked Repository
    8. Creating a Pull Request from a Forked Repository
    9. Removing a Repository Collaborator
    10. Forking Repository
    11. Committing Changes in a Forked Repository
    12. Opening Pull Request from a Forked Repository
    13. Approving and Merging a Pull Request from a Forked Repository
  13. Chapter 13 : Git Tags
    1. Section 13 Introduction
    2. Git Tags Overview
    3. Staging Versus Production
    4. Semantic Versioning
    5. Lightweight Versus Annotated Tags
    6. Creating Lightweight Tags
    7. Creating Annotated Tags
    8. Exploring a Git Tag Object
    9. Pushing Tags to Remote
  14. Chapter 14 : Rebasing
    1. Section 14 Introduction
    2. Introduction to Rebasing
    3. Merging Versus Rebasing
    4. How to Perform Rebasing
    5. Rebasing - Step 1
    6. Rebasing - Step 2
    7. Creating a New Repository
    8. Creating a Feature Branch and Making Changes
    9. Rebasing a Feature Branch on Top of Master Branch
    10. Completing Rebasing by Performing Merging
    11. Exploring Graphs and Commits in SourceTree
    12. Deleting a Feature Branch and Pushing to Remote
  15. Chapter 15 : Ignoring Files in Git
    1. Section 15 Introduction
    2. Introduction to Git Ignore
    3. Git File Statuses: Untracked, Tracked, and Ignored
    4. Basic Git ignore Rules
    5. Pushing Repository with Ignored Files to Remote
    6. Committing Previously Ignored Files
    7. Ignoring Previously Committed Files
    8. Git ignore Common Practices and Templates
  16. Chapter 16 : Detached HEAD
    1. Section 16 Introduction
    2. Detached HEAD State
    3. Making Experimental Commits in Detached HEAD State
    4. Retaining Changes Made in the Detached HEAD State
  17. Chapter 17 : Advanced Git
    1. Section 17 Introduction
    2. Cloning One of the Public Repositories
    3. Git Log Options: Oneline, Graph, and Stat
    4. Git Shortlog
    5. Filtering Commits by Author or Keyword
    6. Pretty Formatting of Git Log
    7. Filtering Merge Commits in Git Log
    8. Git Reset
    9. Git Revert
    10. Modifying the Last Commit Using the Amend Option
    11. Cherry-picking Commits
    12. Reflog - Log of All Git Operations
    13. Stashing Changes Using Terminal
    14. Stashing Using GitHub Desktop
    15. Garbage Collection
    16. Squashing of Commits in GitHub
    17. Interactive Rebasing with Squashing in the Local Repository
    18. Git Development Workflow
  18. Chapter 18 : GitHub Pages
    1. Section 18 Introduction
    2. Creating a Simple Website Using GitHub Pages
    3. Hosting any Repository Using GitHub Pages
    4. Creating a Basic React application
    5. Preparing the React Application for Publishing to the GitHub Pages
    6. Fixing Errors with Cached Credentials Using SSH Instead of HTTPS
    7. Verifying a React GitHub Page
    8. Configuring a Custom Domain for GitHub Pages
    9. Creating a Static GitHub Page Using Markdown
  19. Chapter 19 : GitHub Hooks
    1. Section 19 Introduction
    2. Normal Git Workflow without Hooks
    3. What are Git Hooks?
    4. How Git Hooks can Be Used in Practice
    5. Using a Pre-Commit Hook
    6. Enabling a Post-Commit Hook
    7. Disabling Rebasing Using a Pre-Rebase Hook
    8. Matching an Author's Email against a Regular Expression
    9. Why Local Git Hooks are not Pushed to the Remote
    10. Cleaning Up the Local Git Hooks Repository
    11. Initializing a New Node.js Project
    12. Installing the Jest NPM Package for Testing
    13. Adding Multi and Sum Modules with Tests
    14. Using the Pre-Commit NPM Package for Automation of the Pre-commit Hook
    15. Cloning a Remote Repository and Verifying a Pre-Commit Hook
    16. Replacing a Pre-Commit NPM Package with Husky
    17. Skipping All Git Hooks Using the --no-verify Option
    18. Introduction to Linter and Running Linter in the Pre-Commit Hook
    19. Introducing a Lint-Staged Package to Check only Staged Files
    20. Verifying Selective Linting and Testing Using Lint-staged
    21. Adding a Post-Commit Hook
    22. Verifying Commit Message Using Commitlint
    23. Git Hooks Summary
  20. Chapter 20 : Wrap Up
    1. Wrap Up

Product information

  • Title: Complete Git Guide: Understand and Master Git and GitHub
  • Author(s): Bogdan Stashchuk
  • Release date: February 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781800209855