Book Image

Version Control with Git and GitHub

By : Alex Magana, Joseph Muli
Book Image

Version Control with Git and GitHub

By: Alex Magana, Joseph Muli

Overview of this book

<p>Introduction to Git and GitHub begins with setting up and configuring Git on your computer along with creating a repository and using it for exercises throughout the book. With the help of multiple activities, 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. As you make your way through the chapters, you’ll learn to navigate through the history of a repository, fetch and deliver code to GitHub, and undo code changes. </p><p> </p><p>The first half of the book ends with you learning to work with branches, storing and retrieving changes temporarily, and merging the desired changes into a repository. </p><p> </p><p>In the second half, you’ll learn about forking as part of a collaborative workflow. You’ll also address modularity and duplication through submodules, tracing and rectifying faulty changes, and maintaining repositories. </p><p> </p><p>By the end of this book, you will have learned how to effectively deploy applications using GitHub.</p>
Table of Contents (8 chapters)

Forking the Workflow

The following diagram displays an example of a fork:

Figure 5.1: Fork example
Figure 5.1: Fork example

Exercise 30: Forking a Repository

To set up a fork in the GitHub repository.

  1. Open your favorite browser and go to https://github.com/mrmuli/fork-demo:

    Note

    The following screenshot shows what an original repository would look like on the top-right corner; notice the Fork button.

    Figure 5.2: Fork demo
    Figure 5.2: Fork demo
  2. Select the Fork button, and GitHub should show the following prompt:
    Figure 5.3: Fork location
    Figure 5.3: Fork location
  3. Select your profile, and GitHub should immediately start the process.

    Note

    This should automatically direct you to the fork you just made.

Outcome

From the repository name, GitHub will show the fork icon, the repository name, and the upstream (origin), as shown in the following screenshot:

Figure 5.4: Fork demo
Figure 5.4: Fork demo

Why Do We Fork Repositories?

There are a number of reasons why forking repositories is important...