Version Control with Git and GitHub

A hands-on introduction to the most popular source control solutions used by developers worldwide
Instructor:
Packt Publishing
4 students enrolled
English [Auto-generated]
Understand and implement best practices in version control
Navigating the GitHub UI and installing octo tree
Understand what is Feature Branch Workflow and implement its features
Use forking features, such as submodules and rebasing
Master commands for debugging and maintaining a repository
Implement continuous integration with CircleCi or TravisCi
Gain insight into release management and how GitHub enables software releases

This course introduces version control, its relevance, and usage. In the first part, you’ll learn how to set up and configure Git on your computer. Then, you’ll create a repository and use it for exercises throughout the course. Through multiple demos, you’ll learn concepts that show various stages of a file – from when it is untracked to when it is set for tracking under version control. You’ll see how to navigate the history of a repository, fetch and deliver code to GitHub, and undo code changes. The first part ends with you learning to work with branches, storing and retrieving changes temporarily, and merging the desired changes into a repository.

In the second part, you’ll learn about forking as part of a collaborative workflow. You’ll learn to address modularity and duplication through submodules, tracing and rectifying faulty changes, and maintaining repositories. The second part ends with you learning how to deploy applications using GitHub.

About the Authors

Alex Magana is software engineer keen on developing solutions that matter. He is interested in HCI, machine learning, agritech, information storage and retrieval, and effective backup and recovery. Alex has helped to deliver projects for clients on context-aware location-based services, point of sale software, data analytics for mobile-based banking, and AMP-based performant news pages across a myriad of locales. To let his hair down, Alex enjoys music, dance, adventure, reading, and exploring architecture. He is an avid gastronome at heart.

Joseph Muli loves programming, writing, teaching, gaming, and traveling. Currently, he works as a software engineer at Andela and Fathom, and specializes in DevOps and Site Reliability. Previously, he worked as a software engineer and technical mentor at Moringa School.

Sahil Malik has been a Microsoft MVP and INETA Speaker for the past 8 years, author and reviewer of many books and numerous articles in both the .NET and SharePoint space, consultant and trainer who delivers training and talks at conferences internationally. Sahil has trained for the best names in the Microsoft technology space and has architected and delivered SharePoint based solutions for extremely high profile clients

Introducing Version Control

1
Course Overview

This course draws attention to the facets that make up version control, thus encompassing tracking of code base changes, how to host a code base to support remote access, managing contributors and contributions, and best practices to adhere to. By implementing version control, the creation and enforcement of team-driven checks and controls for introduction, scrutiny, approval, merging, and the reversal of changes, when the occasion necessitates, can be realized.

2
Lesson Overview

This lesson describes the working of version control, workflows and setting up a local and GitHub repository.

3
Defining Version Control

Version control is aimed at supporting the tracking of changes to a file, that is, the reversal of changes made to a file and the annotation of changes introduced to a code base.

4
Navigating GitHub

In this section we will first look at the GitHub User Interface. We will also learn to navigate through GitHub.

5
Runtime Config

This section explains and demonstrates configuring Git using the git config command.

6
Creating a Repository

Version control requires that the files and associated changes that need to be tracked are organized in a repository which is the unit that Git identifies as the candidate for source control. To commence a piece of work, we need to create a repository. In this section, we shall explore two approaches that you may use to initialize a repository.

7
Fundamentals of Repositories

A certain decorum is expected of repositories and users in using Version control and collaborating on GitHub. This propriety ensures that contributions are carried out in an orderly manner and promotes constructive working environments that focus on delivering value. In this section we will look at the fundamentals of Repositories.

8
Summary

Let us summarize what we learnt from this chapter.

9
Test Your Knowledge

Test your learning with this assessment.

Versioning Commits

1
Lesson Overview

In the previous lesson, we covered the concept of version control and various types of workflows. We then analyzed the GitHub UI and GitHub functions, such as teams and SSH. Finally, we created a repository by using GitHub etiquette. In this lesson, we will explain the logic behind the need for versioning commits. Additionally, we will compare commits, branches, indexes, and working trees. By the end of this lesson, you'll be able to demonstrate how to amend commits.

2
Introduction to Versioning Commits Part-1

We have already discussed version control, and we have established that it aids in tracking changes. In this topic, we will address the following question: How can we make Git track and monitor the changes in a file?

3
Introduction to Versioning Commits Part-2

The git diff command is used to compare one snapshot of changes to another. As the name suggests, this utility supports evaluating the differences between two snapshots of a repository. In this section, we will explore some use cases of the git diff command.

4
Introduction to Versioning Commits Part-3

So far, we've established that a file exists in three forms, that is, untracked, unstaged, and staged. We've also explored how to determine the status of a file and examine the changes on a tracked file, whether it be unstaged or staged. We will now explore how to add files to the index from the working tree. This is achieved by using the git add command.

5
Versioning Commits Part-1

The git commit command saves the files in the index. This commit operation stores a message along with the commit. The message describes the additions or alterations associated with the created snapshot. Let’s look at it in detail.

6
Versioning Commits Part-2

This section demonstrates the use of git mv.

7
Amending Commits

This section demonstrates editing commits.

8
Summary

Let us summarize what we learnt from this chapter.

9
Test Your Knowledge

Test your learning with this assessment.

Fetching and Delivering Code

1
Lesson Overview

In this lesson, we'll explore how to configure local repositories to communicate with the hosted repository. To regulate the process of accepting local changes, we'll implement restrictions that enforce benchmarks that, once achieved, will ensure the prevention of error causing changes. We'll look at how we can utilize the connection setup to retrieve changes from the shared hosted repository and make local changes available to the hosted repository.

2
Introduction to Versioning Commits

To develop a sound grasp of the distributed fashion in which Git implements version control, we will look at some terms that are commonly used to describe the link between the code that is modified locally and the source code that is hosted on GitHub

3
Fetching the Code Part-1

In this section we will first learn to configure the base branch and branch protection. We will then learn to fetch, push, pull and retrieve changes.

4
Fetching the Code Part-2

This section demonstrates how to use the git pull and git revert command.

5
Fetching the Code Part-3

This section demonstrates how to retrieve changes using git reset command.

6
Summary

Let us summarize what we learnt from this chapter.

7
Test Your Knowledge

Test your learning with this assessment.

Branches

1
Lesson Overview

In this lesson, we'll look at a common workflow that's utilized in version control, the feature-branch workflow. In doing so, we will also learn about branches and how changes are affected through the merging of branches and shipping the work to the user-facing product on your live environment. The topics covered in this lesson are geared toward demonstrating how version control fits into the picture, from when you start building a feature to when it's shipped.

2
Utilizing Workflows Part 1

Workflows refer to the approach a team takes to introduce changes to a code base. A workflow is characterized by a distinct approach in the use of branches, or lack thereof, to introduce changes into a repository. Let’s look at it in more detail.

3
Utilizing Workflows Part 2

In this section we will learn about the Feature Branch Workflow and Forking a Workflow in detail.

4
Feature-Branch Workflow-Driven Delivery

This section demonstrates using a feature-branch workflow.

5
Creating, Renaming, Deleting, and Listing Branches

This section demonstrates how to create, rename, delete, and list branches.

6
git stash list and Merging

In this section we will learn about git stash list and merging.

7
Pull Request

A pull request (PR) is the culmination of a piece of work undertaken on a branch. A PR is an intent to merge. Pull requests are intended to avail the forum where changes that are to be made to a repository's main branch are accorded scrutiny. Consensus is arrived upon the completion of a satisfactory discussion on the modifications that are borne by the branch that seeks to introduce changes. To gain a clear picture of the changes that a PR seeks to introduce, we need to check the diff between two branches. Let's take a look at how you can achieve this.

8
Identifying and Fixing Merge Issues

As part of incorporating changes, certain checks need to pass for a pull request to be merged. These checks vary from repository to repository. In this section, we will explore failed status checks and merge conflicts.

9
Merging and Reverting Pull Requests

This section shows merging and reverting pull requests.

10
Summary

Let us summarize what we learnt from this chapter.

11
Test Your Knowledge

Test your learning with this assessment.

Collaborative Git

1
Lesson Overview

In this lesson, we are going to delve deeper into more Git commands and collaborative workflows. As an individual, you may have encountered public repositories, some labeled open source and some just belonging to different developers. This lesson provides an overview of housekeeping, and explains how to effectively work with highly engaging distributed teams.

2
Forking the Workflow Part-1

This section introduces basic principles of forking the workflow.

3
Forking the Workflow Part-2

We recently covered how to merge changes into a base branch, both locally and through pull requests. It should be noted that merging is one of the ways changes on different branches can be incorporated. Let's recap what happens during a merge as we introduce rebasing.

4
Debugging and Maintenance

In the previous topic, we covered a number of concepts that are helpful in day-to-day version control operations. We have been able to rewrite history through rebasing, understand and implement a forking workflow, and make external contributions. This topic presents a similar focus, except now we'll be looking more into ways that Git can handle root cause analysis and housekeeping operations.

5
Housekeeping

In this section, we will highlight a number of best practices that can be applied towards maintaining a clean and operable repository through the following commands:

• git clean

• git gc

• git prune

6
Summary

Let us summarize what we learnt from this chapter.

7
Test Your Knowledge

Test your learning with this assessment.

Automated Testing and Release Management

1
Lesson Overview

This lesson will introduce a new perspective on handling code and operations on your repositories. We will walk through and implement test automation and release management, which are crucial practices and processes that enable product delivery. Even though they can be related to DevOps, this knowledge is crucial to all developers, regardless of their stacks.

2
Test Automation

Simply put, this is the use of software or tools to control the testing of applications. Test automation enables processes such as Continuous Integration, Continuous Delivery, and Continuous Deployment. Usually, it's the first step of any of the aforementioned processes, and practically what happens on a Continuous Integration pipeline.

3
Automated Pull Requests

You have recently gone through and implemented pull requests. While the procedure still remains the same, this subtopic introduces a better and efficient way of effecting code integrity on pull requests. Here, we get to demonstrate and implement how to prevent branch merges before certain conditions are met.

4
Release Management

We have recently demonstrated automated testing and building on CircleCi. We also concluded that the two processes are building blocks of CI pipelines, which is a critical process that occurs on a software development life cycle. This section will demonstrate the role Git plays in software delivery, more specifically, in release management and as a final stage of software delivery.

5
Git Archive

Apart from enabling release management through tagging, Git enables the packaging of source code as zipped and .tar files, making them available for downloads on release pages, and sometimes on download or installation pages. This is achieved through the git archive command.

6
Summary

Let us summarize what we learnt from this chapter.

7
Test Your Knowledge

Test your learning with this assessment.

You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!

Be the first to add a review.

Please, login to leave a review
6d9a1cd306d029b43dc16435f96c7388
30-Day Money-Back Guarantee

Includes

5 hours on-demand video
Full lifetime access
Access on mobile and TV
Certificate of Completion