Complete Git Guide: Understand and master Git and GitHub
4.7 (457 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.
15,961 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 (457 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.
15,961 students enrolled
Created by Bogdan Stashchuk
Last updated 5/2020
English
English [Auto-generated]
Current price: $90.99 Original price: $129.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 17.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 214 lectures 17:43:12
+ 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
00:42

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

Installing Git on MacOS
02:24

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

Installing Git on Windows
10:41

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

Installing Git on Linux
08:20

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
05:36

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
05:32
+ 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
09:38

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
08:59

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
08:25
+ How Git works under the hood
28 lectures 02:04:14

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
04:12

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
03:02

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
06:45

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
03:57

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
03:29

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
10:18

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
04:09

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
04:11

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
05:56

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
05:24

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
07:56

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
02:40

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
01:56

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
02:41

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
02:25

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

Creating Git Tree object
09:52

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
01:55

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
03:50

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

Git read-tree
03:51

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
01:58

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

Git checkout-index
03:11

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

How many folders could be created for objects
02:20

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

Section Summary
04:20
+ 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
00:53

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

What is Commit
03:59

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
03:50

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

Creating first commit
04:00

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
05:36

Now let me briefly overview current state of our project.

Current project state overview
05:08

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
03:34

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
05:43

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
01:59

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
02:57

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
02:07

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
07:53

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
06:15
+ 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
01:12

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
01:23

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
03:36

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
04:58

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
06:44

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
05:31

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
05:22

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
07:12

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
13:49

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 specific commit.

Why do we need branches
10:36

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

Git branches management
03:04

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
07:20

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
04:35

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
05:31

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
07:34
+ Cloning, exploring and modifying public repositories
10 lectures 01:02:15
Section 7 Introduction
00:55
Cloning remote repository
06:01
Exploring contents of the cloned repository
07:52
Unpacking Git objects
04:06
Exploring cloned repository in GitHub Desktop
05:18
Installing text editor Visual Studio Code
02:45
Exploring Visual Studio Code
06:05
Commit changes in the cloned repository
11:34
Git diff command
13:56
Overview of the changes
03:43
+ Merging branches
15 lectures 01:25:14
Section 8 Introduction
01:14
Why branches merging is needed
03:27
Fast forward merge
04:15
Merging process
01:53
Fast forward merge in action
06:57
3-way merge
05:59
Performing 3-way merge
12:38
Observing Git repository after 3-way merge
06:40
Installing SourceTree
04:00
SourceTree in action
06:34
What is merge conflict
03:05
Creating merge conflict
09:48
Observing conflicts in staging area and working directory
06:44
Resolving merge conflict in Terminal
03:00
Resolving conflicts in VS Code
09:00
+ GitHub and remote repositories
10 lectures 39:57
Section 9 Introduction
00:55
What is Git hosting service
03:35
Creating GitHub account
03:32
Exploring first repository at GitHub
11:00
Creating another commit at GitHub
02:56
Creating new branch at GitHub
01:25
Making changes in the new branch
04:22
Cloning remote repository
05:14
What is remote repository
02:55
How remote repository empowers collaboration
04:03
+ Git push, fetch and pull
22 lectures 02:06:40
Section 10 Introduction
01:35
Overview of the push, fetch and pull Git commands
06:15
What is origin
04:17
List remote and local branches
03:04
What is tracking branch
04:59
Checkout remote branch
03:55
Git remote show origin
03:08
Git fetch in action
06:22
Git pull is 2-step process
03:54
How to perform git pull
05:08
What is FETCH_HEAD
08:24
Git pull with fast forward merge
07:37
Fetch remote changes manually
09:09
Merge FETCH_HEAD manually
06:05
Resolving conflicts during Git pull
11:58
Pushing to remote repository
09:27
Commit under another author
02:42
Remote and local branches are in sync now
03:34
Create remote branch based on local branch
08:52
Update tracking statuses of the branches
07:59
Remove remote branch using local terminal
03:52
Git show-ref
04:24
Requirements
  • 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.
Description

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!