8

8Brackets and remote repositories

8.1

Extending the current project

Currently the project looks like this:

Figure 8.1 - Final arrangement, all merged back to master branch

Figure 8.1   Final arrangement, all merged back to master branch

There is a single master branch with eight commits and the head is at the most recent commit, in my case [07fe437]. In Brackets, the history is:

Figure 8.2 - Brackets commit history

Figure 8.2   Brackets commit history

The repository has the following eight files:

LIST OF FILES AT COMMIT 07FE437   TAG: P03

index.html

01-intro.html

02-about.html

README.md

.gitignore

11-resources\01-css\style.css

11-resources\02-images\logo.png

11-resources\02-images\readme.png

Table 8.1   File list at commit point P03 [07FE437]

Before we start working with the remote repository, I want to create a new branch and commit point in the local project—this is to demonstrate how GitHub handles branches.

I’m going to add a new 03-contact.html page and I’m going to do so by creating a new branch from the most recent commit point [07fe437] on the master branch. From the master branch, create a new d-03-contact branch and switch to it (see § 6.5 for instructions about creating and changing branches).

Now we have Figure 8.3, the head is on the new branch, but there are no further commits yet (to make the diagram readable, I’ll only show the most recent commits):

Figure 8.3 - The d-03-contact branch

Figure 8.3   The d-03-contact branch

Time for another file; in the new d-03-contact branch create a file 03-contact.html in the root folder (same place as index.html) and add the following code to it (This is just like we did in § 6.5.2):

03-contact.html
<html lang="en">                     <!-- Declare language -->
    <head>                           <!-- Start of head section -->
        <meta charset="utf-8">       <!-- Use Unicode character set  -->

<link rel="stylesheet" type="text/css" href="11-resources/01-css/style.css">

        <title>PracticalSeries: Git Lab — Contact us</title>
    </head>

    <body>
        <h1>A Practical Series Website</h1>

        <h3>Contact Us</h3>

<p>This page explains how to email Practical Series.</p>

    </body>
</html>
Code 8.1   d-03-contact branch—create new file: 03-contact.html a

Save the file and in the Git pane tick the box to stage the file:

Figure 8.4 - 03-contact.html

Figure 8.4   03-contact.html

Commit the changes with the commit message:

D: Incremental Build - 03-contact page

03-contact added.

Give the new commit point the tag d-P03.03.01. In my case the commit point is [8329b67].

I now have nine commits:

Figure 8.5 - Current commits

Figure 8.5   Current commits

The workflow is:

Figure 8.6 - The d-03-contact branch

Figure 8.6   The d-03-contact branch

The last thing is to switch back to the master branch, the master branch is still the only deployable branch and it is this branch that I want to upload to the remote repository first.

Click the arrow next to the d-03-contact branch and select master from the dropdown.

This gives the following: back on the master branch there are only eight commits and the new file 03-contact.html is not in the file list (this is on the d-03-contact branch and not visible from the master branch):

Figure 8.7 - Local repository master branch

Figure 8.7   Local repository master branch

The work flow is now (just the same but with the head on the master branch):

Figure 8.8 - Local repository master branch

Figure 8.8   Local repository master branch

Leave it like this for now while we get the remote repository established.



End flourish image