Source Control with Git
Linux Training Architect II in Content
This is an introductory course that will help get someone new to Git up and running with it quickly. We will show you the basics of working out of your own local repository, and then we will apply those skills to working with remote repositories such as the ones you would find on GitHub and BitBucket.
We will also see how we can install our own web-based Git server by using the free version of GitLab. So if you ever wanted to learn the basics of working with Git, this is the course for you.
The introduction to our course on git.
About the Course Author
A little bit about me, your course author.
Installation of Git
Installation of Git
Installing Git on a Red Hat Based Distribution
Here is a walkthrough on installing git on a Red Hat based Linux distribution.
Installing Git on a Debian Based Distribution
A walkthrough on installing git on a Debian based Linux distribution.
The Basics of Using Git
Understanding the Git File System
An overview of git's architecture.
Creating a Local Repository (Empty)
Find out how to create a new git repository on your local system.
Basic Configuration of Git
Learn how to set up some basic parameters for your git environment. We will see how to configure the basic settings required for a git commit, and this is done via the git config command.
Adding Files to a Project
Learn how to add files and folders to a project that git will track. We will also cover a caveat to removing a file from git that has not been committed yet, and how to resolve that issue. This is the very first step to getting your files tracked with git.
The Status of Your Project
Use the status command with git to find out details about your current project's state. This will help you track your staged and unstaged files, and show you changes that are waiting to be committed. This way, you are always on top of the states of your files for your project.
Committing to Git
Now that you have items added to your repository, you will need to commit the changes to your project. Learn how git keeps track of the files that you commit, and how to safely remove them. We will perform these tasks with the git commit command.
Ignoring Certain File Types
Learn how to configure your git environment to ignore certain types of files that you don't want tracked. We will use a .gitignore file and show you how to use the git check-ignore command. This will help to keep your git repositories clean from unwanted files.
QUIZ: The Basics of Using Git
Tags, Branching, Merging and Reverting
Tags, Branching, Merging and Reverting
Learn how to tag a commit in git. This is useful when you want to mark a point in your project's history, or use a specific tag as a reference point, such as a release of a specific version. We will use the git tag command, and show you how to view all tags on a project, and how to delete them should you need to.
Here we learn about the basics of branching in git. This is helpful so that you can work on a different development line without altering your stable line of work. We show you how to create new branches, and switch between existing branches.
Learn how to merge the works of different branches together. We will demonstrate the 'git merge' command. We will also find out how to deal with merge conflicts when we have work from different branches clashing with each other.
In this lesson, we will discuss an alternative method for applying changes to a branch - through rebasing. You would likely use a rebase method of applying changes when you want to push your own work to a remote repository. We demonstrate the use of the 'git rebase' command to see how a rebase works.
Reverting a Commit
This lesson will show you how to revert a commit in your project. You would want to revert a commit if you have something in your project that is interfering with the rest of the project, or if there was a mistake that you would like to rectify. We will use the 'git revert' command to accomplish this task.
Using the 'diff' Command
Find out how to use the 'git diff' command to see what changes have been applied between commits. You will also see how to determine what changes have been made within your staging area. This is a good way to keep track of the various changes within your repository.
How Garbage Collection Works
Learn about how git cleans up loose objects within a repository. We will demonstrate the usage of the 'git gc' command to clean up our repository and optimize our database. This is helpful if you have a large project and you need to keep git running in an efficient manner.
QUIZ: Tags, Branching, Merging and Reverting Using Git Source Control
Logging and Auditing
Git's Logs and Auditing
Using Git's Logs
Learn how to use the built-in logging functionality of git to keep track of what's going on with the repository. We will use the git log command and some of its more common options to format the log's output. This will also help you visualize the activity of your project.
QUIZ: Git Logging and Auditing
Cloning Local Repositories
Learn how to clone a local repository as a backup or as a testing ground for features or database work. We will demonstrate the basic usage of the git clone command to clone a local repository to a new location on the local system.
Cloning Remote Repositories over HTTPS
Find out how to clone remote repositories from popular sites such as GitHub onto your local system. We will clone over HTTPS, and show you what you get when you clone a project. We will use the 'git clone' command, just as we did when we cloned a local repository.
Learn about the fundamentals of forking a git project. We will discuss what forking a project means, and how you can have your own copy of a project still track the original project that it came from.
QUIZ: Cloning Git Repositories
Push, Pull, and Tracking Remote Repositories
Tracking Remote Repositories
In this lesson, we learn how to set up our SSH key pairs for working with GitHub (the same process would apply to BitBucket as well). We learn how to clone a remote repository over SSH, and how to track it with the 'git remote' and 'git fetch' commands. This is the way that most projects work with remote repositories.
Pushing to Remote Repositories
Find out how easy it is to push local changes to a remote repository. We do this with the 'git push' command. If you want your modifications to be included in an upstream project, you will need to perform this task first.
Now that you have your contributions to a project pushed to the remote repository, you will need to create a pull request to get it incorporated. Learn how easy it is to create a pull request on GitHub, and get your latest commit merged into the project.
QUIZ: Push, Pull and Track Remote Git Repositories
GitLab - Installation, Configuration and Use
Setting Up and Using a GitLab Server
What is GitLab?
In this video, we discuss GitLab and its two versions: Enterprise and Community Edition. We will build out our own GitLab Community Edition server in this section, so this video is an introduction to what GitLab is, and what some of its components are.
Download, Install and Configure for Local Use
In this video, we walk through the installation of GitLab Community Edition on a Linux Academy Cloud Server (using CentOS 7). Note that this install will take at least 30 minutes, so budget your time for this exercise. Also, it would be best to use a CentOS image that has at least 4GB of RAM for better performance.
Adding Users and Groups to GitLab
In this lesson, we will learn how to add new users and groups to our GitLab server. Then we will see how we can apply different permissions to both users and groups. This is to help maintain the security of the system and the projects it contains.
Creating and Managing Projects
Learn how to create project repositories in GitLab, and set up your local system to track it. We will use SSH keys to manage the access, and add our first file to the project. This is your first step to managing projects in GitLab.
Push Changes and Merge with GitLab
Here we will discuss the process of pushing changes from a new branch up to the GitLab server. Then we will see how to merge those changes. We will work from the command line on our local branch, then use the GitLab web interface to merge the changes.
Now that you have completed the course, find out about what you can tackle next!