Complete Git Guide: Understand and master Git and GitHub
4.7 (686 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
17,145 students enrolled

Complete Git Guide: Understand and master Git and GitHub

Complete Git and GitHub guide. Master basic and advanced Git features: commits, branches, merging, rebasing, squashing.
Highest Rated
4.7 (686 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
17,145 students enrolled
Created by Bogdan Stashchuk
Last updated 7/2020
English [Auto]
Current price: $90.99 Original price: $129.99 Discount: 30% off
23 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 19.5 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Deeply understand how Git works under the hood
  • Use Git not just in terminal but also in graphical user interfaces like GitHub Desktop, SourceTree, Visual Studio Code
  • Learn different GIt objects - blobs, trees, commits and annotated tags
  • Create local and remote Git repositories
  • Perform basic and advanced Git operations
  • Learn how to perform rebasing and merging of the branches
  • Learn what is pull request and how to create pull request at GitHub
  • Contribute to public repositories using technique of forks and pull requests from the forked repository
  • Understand what is semantic versioning and how to use Git Tags in order to create software release versions
  • Learn advanced Git operations - squashing, cherry-picking, amending, reverting commits.
Course content
Expand all 224 lectures 19:17:18
+ Introduction to the Git and GitHub
2 lectures 06:58

Introduction for the first section of the course where I will compare Git and GitHub

Preview 01:28

What is the difference between Git and GitHub? Let's discuss it in this lecture!

Preview 05:30
+ Installation of the Git and configuration of the Shell
6 lectures 33:15

In this section you will install Git on your computer and configure Shell

Section 2 Introduction

If you use Mac OS this lesson is for you. I will show you how to install Git on Mac.

Installing Git on MacOS

If you use Windows, this lecture is for you. I will show you here how to install Git on Windows.

Installing Git on Windows

Installation of Git on Linux is very simple. In this lecture I will demonstrate you how to do it.

Installing Git on Linux

If you use Mac I highly suggest you to install custom Terminal called iTerm2 and use it instead of built-in Terminal.

Installing iTerm2 on the Mac

Along with iTerm2 it's a nice idea to install also custom shell called Z-Shell. In this video I will guide you through this process.

Installing custom shell Z-Shell on the Mac
+ Basic Shell commands
4 lectures 27:45

In this course you and I will heavily use Shell. In this section I will show you basic commands that you will use for different operations like creation of new folders, files etc.

Preview 00:43

In this lecture I will demonstrate you how to perform directory management in Shell.

Shell commands - directory management

In this lecture I'll demonstrate you how to perform file management using Shell. You will learn how to read files the how to edit files using such editors like Nano.

Shell commands - file management - PART 1

In this lecture we will continue discussion of file management commands in Shell and the I'll demonstrate you some examples.

Shell commands - file management - PART 2
+ How Git works under the hood
29 lectures 02:31:27

It is very important to understand how Git works under the hood. That's why let me quickly go over topic we will discuss in this large section.

Preview 00:57

First step in the management of repositories is the creation of the new Git repository. In this lecture I will show you how to perform initialisation of the new Git repository.

Initialize new Git repository

After initialisation of the new Git repository you will see that Git will create .git folder. And in this lecture I'll show you contents of this .git folder.

Preview 04:01

Let me now explain you which object types Git could store in the  .git folder.

Git object types

It is possible to insert the new object into the Git repository with git hash-object command. And in this lecture I'll demonstrate you how to perform this task yourself manually.

Writing new Git object with git hash-object

Structure of the Git repository is very similar to JSON structure. And in this lecture I'll demonstrate you what are the similarities and what are the differences between JSON and Git repository.

JSON vs Git database

Every object that is stored in the Git repository is stored with unique name. And this unique name is generated using SHA1 hash function. In this lecture I'll tell you what is hash function and how it works.

Preview 03:52

There are different hash functions available. In this lecture I will explain you difference between some hash functions and tell you which hash function is used in Git.

Hash functions overview

SHA1 hash function generates hash that is 160 bits long. And exactly this hash function is used in Git for creation of the unique id for every object like Git blob, tree or commit.

SHA1 Hash Function

You already know that Git creates unique hashes for every file that is stored in the repository. And here I want to explain you how many files in total Git could store in the Git repository.

How many files Git could store

Let me know get the back to the very simple Dice game and explain you some basics of probability theory and how it could be applied to Git.

Probability theory in Dice game

Let me know talk about the probability of getting exactly the same numbers in the Dice game and same hashes in the Git repository

Git hash collision probability
More details on hash collision probability

It is possible to read Git objects using specific command that is called git cat-file. With this command you are able to read the contents of specific object in the Git repository. Also you are able to read the type of the object and it's length.

Exploring Git objects with git cat-file command

In this lesson I'll demonstrate you how you are able to create new Git blob in the Git repository from the contents of specific file.

Create new Git Blob based on the file

In fact Git does not store file names along with every blob. Every blob has unique filename that  is based on the SHA1 hash of this file. That's why Git needs to store filenames somewhere else.

Git blobs don't store filenames

Every Git object has specific structure. Git stores following data in every object: type, length, delimiter and content.

Preview 10:14

We have just discussed some internals of Git and now you know how Git stores every object in the Git repository.

What we have so far

There are four different types of Git objects. They are blob, tree, commit and annotated tag. Let me now explain you what is the purpose of the tree objects in Git.

Tree objects in Git

Git tree object stores actual filenames and SHA1 hashes for every blob. Also it stores file permissions of every blob. In this lecture I want to tell you about the different possible object permissions.

Git object permissions

You could create new Git tree object manually. Now let me demonstrate how you are able to do that.

Creating Git Tree object

Let's now examine contents of the Git tree object.

Preview 04:52

Let me know talk about the difference between working directory, staging area and git repository.

Working directory, Staging area and Git repository

Let me now show you where all files that we have created before are located in terms of working directory, staging area and Git repository.

Overview of current files distribution

Let me know show you how you're able to use such command as git read-tree.

Git read-tree

Sometimes it's useful to read files that are located in the staging area. You could read the files in the staging area using command git ls-files.

Read files in the staging area using git ls-files

You could move files from the Git repository to the staging area using command git checkout-index.

Git checkout-index

Let's now calculate how many different folders could be created in the Git repository

How many folders could be created for objects

Let's now summarise what we have discussed in this large section dedicated to the Git internals.

Section Summary
+ Basic Git operations
14 lectures 01:02:31

In this section we will talk about the basic Git operations. I will explain you how to create a new commit, how to perform management of the git repository, how to add the files to the staging area, how to remove files from the staging area and so on.

Section 5 Introduction

Let me now explain you what is commit and why it is needed.

What is Commit

Before starting using Git you should configure global Git name and email that will be appended to all commits you will make.

Configure Git author name and email

Let's now finally create you very first commit in your very first git Project

Creating first commit

We have just created the very first commit in the Git repository. Now it's a good time to explore contents of this commit object.

Exploring commit object

Now let me briefly overview current state of our project.

Current project state overview

We have just created very first commit in the repository. Now let's talk about basic Git comments like git status, git log and git checkout.

Basic Git commands

Now let me demonstrate you how you're able to add the new file to the working directory in Git.

Adding new file to working directory

Every file has its own lifecycle and there are several possible locations where files could be stored in Git. File could be located in the working directory, staging area or repository.

Preview 08:37

If file is already located to in the working directory you are able to stage this file and move it to staging area as well. This process is called "stage file".

Stage file

If specific file is already present in the Git staging area you are able to remove it from the staging area using git rm command

Unstage file using git rm

If some files are already present in the working directory and staging area it's a good time to commit them. And here I'll explain you what happens when you commit changes.

Commit changes

As you see every file in Git could be either untracked or modified, or staged, or unmodified. Let's now explore changes in our Git repository.

Exploring changes in Git repository

At the moment in the Git repository there are two different commit objects, two different tree objects and three different blobs. Let me explain you all of that using a graphical diagram.

Current diagram of Git repository
+ Git branches and HEAD
16 lectures 01:34:44

In this section we will talk about the Git branches and Git HEAD. I will explain you how to create a new branch of how to switch between different branches

Section 6 Introduction

No I will explain you how to move files between working directory, staging area and Git repository. I will show you how to use following commands: git add, get commit and git checkout.

Preview 06:17

Let's explore the structure of the project at this moment of time. At the moment there are three different blobs, two different trees and 2 commits.

Overview of the current project state

GitHub Desktop is a very useful GUI application and using the GitHub Desktop you could easily manage multiple Git repositories and perform different Git actions.

Installing GitHub Desktop

Let me now explain you most common features of the GitHub Desktop and I'll explain you how to add Git repository and how to explore it inside of the GitHub Desktop

GitHub Desktop Overview

Branch in Git is a simple pointer to specific commit and in this lecture I'll explain you features of the branch in Git

What is branch in Git

In Git there is specific term called HEAD and in this lecture I will explain you what is HEAD and how it is used in Git

What is HEAD in Git

At the moment there are two different commits and now it's a good time to create one more commit and afterwards we will explore changes in Git repository after this third commit

Third commit

We have just created one more commit in the Git repository and now let's explore what was changed in the repository after this last commit. There will be actually one more commit object and one more tree object.

Git repository changes after third commit

Now you know that the HEAD points to the currently checked out branch. In this lecture let me show you how you could checkout specific commit by using its SHA1 hash.

Checkout specific commit

Let me now explain you why we need branches. Branches are needed if you want to work on multiple features in the same project in parallel. And branch is simply pointer to the specific commit.

Why do we need branches

Let me now quickly explain you how you could manage multiple branches in the same Git repository.

Git branches management

You could quickly and easily create a new Git branch by using the git branch command. Also you could use a git checkout command with option -b in order to create new branch and immediately switch to this newly created branch.

Create new branch

Let's now create new branch and switch to it. Afterwards lets make some changes there and commit those changes.

Commit changes in the new branch

We have just created a new branch and made some changes in this new branch. Afterwards we have committed those changes. Now let's explore changes made in the last commit in the new branch.

Explore commit in the new branch

Now let me talk about very important Git feature. Git re-uses blobs with the same content. There is no need to create new blob if there is already blob with the same contents in Git repository.

Git reuses blobs with the same contents
+ Cloning, exploring and modifying public repositories
10 lectures 01:02:15
Section 7 Introduction
Cloning remote repository
Exploring contents of the cloned repository
Unpacking Git objects
Exploring cloned repository in GitHub Desktop
Installing text editor Visual Studio Code
Exploring Visual Studio Code
Commit changes in the cloned repository
Git diff command
Overview of the changes
+ Merging branches
15 lectures 01:25:14
Section 8 Introduction
Why branches merging is needed
Fast forward merge
Merging process
Fast forward merge in action
3-way merge
Performing 3-way merge
Observing Git repository after 3-way merge
Installing SourceTree
SourceTree in action
What is merge conflict
Creating merge conflict
Observing conflicts in staging area and working directory
Resolving merge conflict in Terminal
Resolving conflicts in VS Code
+ GitHub and remote repositories
10 lectures 39:57
Section 9 Introduction
What is Git hosting service
Creating GitHub account
Exploring first repository at GitHub
Creating another commit at GitHub
Creating new branch at GitHub
Making changes in the new branch
Cloning remote repository
What is remote repository
How remote repository empowers collaboration
+ Git push, fetch and pull
22 lectures 02:06:40
Section 10 Introduction
Overview of the push, fetch and pull Git commands
What is origin
List remote and local branches
What is tracking branch
Checkout remote branch
Git remote show origin
Git fetch in action
Git pull is 2-step process
How to perform git pull
Git pull with fast forward merge
Fetch remote changes manually
Merge FETCH_HEAD manually
Resolving conflicts during Git pull
Pushing to remote repository
Commit under another author
Remote and local branches are in sync now
Create remote branch based on local branch
Update tracking statuses of the branches
Remove remote branch using local terminal
Git show-ref
  • We will start from the very beginning, from basic Git features and move on to advanced techniques and operations
  • Prepare only your Mac, Windows or Linux/Unix computer. Anything will work.
  • If you are new to Git, please start from the very beginning: learn how Git works and how to perform basic operations (git add, git commit, git branch)
  • If you are advanced Git user I highly recommend you to watch "How Git works under the hood" section and then jump to advanced Git features like squashing, cherry-picking etc.

This course is all about Git and GitHub.

Understand HOW Git works and learn all Git features from basic commits to squashing and rebasing.

  • Blobs, Trees, Annotated tags, SHA1 hashes

If those terms are new to you - jump in and you will learn all about Git internals and afterwards practice basic and advanced Git features using multiple practice activities.

Become a master of Git, GitHub, GitHub Desktop, SourceTree and Visual Studio Code.

This is the most complete practical Git and GitHub guide here on Udemy that includes tons of practical activities. Most important is that you will learn how Git works and knowing it you will be able much more easier use Git features and fix mistakes in your development workflow. You can have zero knowledge about Git and GitHub. All will be taught from scratch, from basic to advanced features. If you want to get deep knowledge of Git and GitHub this course is for you!

We will start by exploring internal structure of the Git repository. You will learn that Git has 4 types of objects: blobs, trees, commits and annotated tags. Each object has unique SHA1 hash. Also all objects are stored in the folders. Every object has just single reference to it - SHA1 hash. Files are stored in blobs. Filenames are stored in other Git objects called trees.

I will explain you how to create new Git objects without using git commit and git add. After creating Git object in the Git repository you will checkout it to staging area and working directory (opposite direction to traditional Git flow)

Afterwards we will jump into tons of practice activities and use different Git and GitHub features

In practice sections you will perform multiple practice Git activities:

  1. Initialize new Git repository

  2. Make changes, add them to staging area and commit

  3. Create branches, checkout branches and merge branches

  4. Perform fast-forward and 3-way merges of the branches

  5. Resolve merge conflicts

  6. Move into detached HEAD state and make experimental commits there

  7. Perform rebasing of the branches

You will also learn and practice different GitHub features

  1. Connect local and remote repositories

  2. Pushing, fetching and pulling operations

  3. Open Pull Request

  4. Merge Pull Request

  5. Add software versions using Git Tags

  6. Create forks from other repositories

  7. Contribute to public repositories using technique of forks and pull requests

  8. Perform rebasing with squashing

You will use not just terminal and shell commands for performing Git operations. In parallel you will also use GUI applications that simplify routine day-by-day Git operations:

  • GitHub Desktop

  • SourceTree

  • VisualStudio Code

With this course you will get lifetime-long access to almost 200 lectures and tens of practical exercises. After the course you will become a guru of Git and GitHub and will be able easily perform basic and advanced Git tasks.

But most important is that you will UNDERSTAND Git.

You will also get 30-days money-back guarantee. No questions asked!

Don't wait and join the course now!

Who this course is for:
  • You could be either complete beginner or experienced developer with years of usage of Git
  • You may know how to USE Git but you may not know HOW Git works
  • If you want to learn HOW and WHY Git and GitHub work - this course is for you!