Info2180 Lab1
Info2180 Lab1
Info2180 Lab1
For this lab you will be getting comfortable with the basics of the terminal/command
line and also learn the basics of Git and Github. You will also create a simple HTML
page and style it’s content.
If you are on Windows, I suggest you try to use "Windows Powershell." If you are using
Linux or macOS then I suggest you start by using the default "Terminal" application.
When you rst open the Terminal you will typically see your command prompt and it
looks something like:
For the purpose of this lab and the course we will shorten this and simply use $ before
any of the commands we want to execute at the command line. Note: You don't need to
add the $ to the command.
1. The rst command we want to try is the pwd command. This stands for Print
Working Directory.
$ pwd
$ ls
3. The third command we want to try is the cd command. This command stands for
Change Directory. So at the command line type:
$ cd
and if you know the name of the directory or path you want to go to you can type:
$ cd {childFolderName}
e.g. $ cd Documents/
You can also navigate up one directory from the one you are currently in by using
"../". For example:
$ cd ../
$ mkdir some-folder
$ rm index.html
fi
fi
fi
fi
fi
fi
fi
• rmdir - Deletes the directory at the speci ed path. e.g.
$ rmdir some-folder/
$ cp styles.css some-folder/
$ mv somefile.txt my-folder/
Continue to play around with these commands and get familiar yourself more familiar
with the command line/terminal.
$ git --version
You should then see the version printed. For example: git version 2.42.0
fi
fi
fi
fi
fi
fi
fi
4. Run the following commands to con gure your Git username and email using the
following commands, replacing Emma's name and email with your own. These
details will be associated with any commits that you create:
$ git --version
You should then see the version printed. For example: git version 2.42.0
4. Con gure your Git username and email using the following commands, replacing
Emma's name and email with your own. These details will be associated with any
commits that you create:
$ git --version
fi
fi
fi
fi
fi
fi
You should then see the version printed. For example: git version 2.42.0
3. Con gure your Git username and email using the following commands, replacing
Emma's name and email with your own. These details will be associated with any
commits that you create:
NOTE: Ensure you change the URL and use the one that you copied in Step 1.
$ cd info2180-lab1
4. You can then type the command ls and you should see a README.md le.
# INFO2180 Lab 1
3. Save the le and then at the command line (or Windows Powershell), type:
$ git status
It should now mention that there is nothing new to commit and that the working
tree is clean.
$ git push
It may ask you to enter your Github username and password. Enter it and then
press enter. If all goes well you can then view your Github repository on the Github
website and you should see that the le exists on Github with the changes you
made to the le.
fi
fi
fi
fi
fi
7. To see the history of the commits you can run the following command:
$ git log
1. Next, we will learn to create a branch. Branching allows us to create a copy of our
code that we can work on in isolation without necessarily affecting main branch of
our code (typically called the 'master' or 'main' branch). There are two ways to
create a branch:
or
# INFO2180 Lab 1
## Branching
4. Now let's see what happens when you type git status. Git will inform us whether or
not we have new les, and les updated. But, what's the difference between the
old le and the new le.
$ git push
It should give you an error, that the current branch does not have an upstream
branch. All we need to do is setup an association with our local branch with our
origin, which in this case is Github.
7. If we go on Github, you might not see your changes, this is because on Github you
are still viewing the main/master branch. So you can switch that branch by clicking
on the "Branch: main" (or master) button and choosing the branch "update-
readme". You should now see your changes to the README.md le.
fi
fi
fi
fi
fi
8. Lastly, let us now merge the changes we made in the "update-readme" branch into
our "main" branch (or it may be called the "master" branch). To do this on the
command line, switch back to your master/main branch using:
then run:
Once that is done, it should merge your changes from the update-readme branch
into the main/master branch.
$ git push
Notice this time we didn't need to do the --set-upstream as Github already
knows about this branch.
10. If you now look back at your Github repo and switch back to the master branch you
should see all the changes that were on your updated-readme branch now
appearing on your master branch as well.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-
width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>INFO2180 Lab 1</title>
</head>
<body>
<header>
<h1>INFO2180 Lab 1</h1>
<p>This is a simple webpage for Lab 1 of INFO2180.</p>
</header>
<main>
<h2>[Your Name]</h2>
<p>[Paragraph about myself]</p>
</main>
<footer>
fi
fi
fi
fi
<p>Copyright © 2020 <Your Name>.</p>
</footer>
</body>
</html>
3. Next, ensure you add, commit and push that code to your Github repository.
4. Next, create a CSS le called "styles.css" and link it within your index.html
le using the appropriate <link> tag. You are to ensure you style your:
- Level 1 heading (ie. <h1>) to have a font-size of 24px and font colour to be
#38B2AC.
- Level 2 heading (ie. <h2>) to have a font-size of 21px and font color to be
#5A67D8.
- And your paragraph (ie. <p>) should have a font-size of 18px.
5. Also change the text between the <h2> heading within the <main> tag to have your
name and write a paragraph about yourself and why you are interested in Web
Development.
6. Ensure you you add, commit and push that code to your Github repository.
7. Next add an image to your folder and add it to your index.html le using the
appropriate image tag. Please use a relative path (ie. DO NOT use an absolute
system path like C:/foldername/myimage.jpg). Also ensure that you name the le in
the proper case (ie. any letters that are uppercase should be uppercase and any
that are lowercase should be lowercase).
8. Ensure you add, commit and push that code and your image le to your Github
repository.
9. Next, switch back to your main (or master) branch and then merge the changes
you made in your "webpage" branch back into your main branch. Then ensure you
push those changes back to your Github repository.