---
# System prepended metadata

title: Assignment 2

---

How to Create Your First Web Page Using HTML and Track Changes with Git

Creating your first web page using HTML and tracking your changes with Git is an excellent way to start your journey into web development. HTML is the backbone of web pages, while Git helps you manage and track your code changes efficiently. This guide will walk you through the process, from setting up your project to pushing your code to GitHub.

1. Introduction

HTML (HyperText Markup Language) is the standard language for creating web pages. It provides the structure for web content, including text, links, images, and more. On the other hand, Git is a version control system that allows developers to track changes, collaborate on projects, and revert to previous versions if needed. Using Git is crucial for maintaining a clean and organized development workflow, especially in collaborative environments.

2. Setting Up the Project

Before writing any HTML, you need to set up a project folder and initialize a Git repository.

Create a project folder: Choose a location on your computer and create a new folder. You can name it something like my-first-webpage.

Initialize a Git repository: Open a terminal or command prompt, navigate to your project folder, and run the following command

git init

This initializes an empty Git repository in your project folder.

Create the first index.html file: Inside your project folder, create a new file named index.html. This will be the main file for your web page.

3. Writing the HTML Code

Now, let's create a basic structure for your web page.

Open index.html in a text editor and add the following code:

<!DOCTYPE html>
<`html`>
<`head`>
    <`title>`My First Web Page<`/title`>
<``/head`>
<`body`>
    <`h1`>Welcome to My First Web Page<`/h1`>
    <`p`>This is a simple web page created using HTML.<`/p`>
    <`a href="https://www.example.com"`>Click here<`/a`> to learn more.
<`/body`>
<`/html`>

This code defines a simple HTML document with a heading, paragraph, and a hyperlink.

4. Using Git for Version Control

To track your changes using Git, follow these steps:

Stage and commit changes: After adding content to index.html, you need to save it in Git's history.

git add index.html
git commit -m "Initial commit: Added index.html"

The git add command stages the file, and git commit saves it with a meaningful message.

Write meaningful commit messages: When committing changes, always use clear and descriptive messages so that you and others can understand what was modified.

5. Pushing Code to GitHub (Optional for Advanced Students)

Once you have made changes locally, you may want to store them on GitHub.

Create a GitHub repository: Log in to GitHub, create a new repository, and copy the repository URL.

Connect your local repository to GitHub: In your terminal, run:

git remote add origin <`your-repository-url`>

Push changes to GitHub:

git push -u origin main

This uploads your local project to GitHub, making it accessible from anywhere.

6. Conclusion

Congratulations! You have successfully created your first web page using HTML and tracked your changes with Git. You have also learned how to set up a project, write basic HTML, and use Git for version control. To continue improving your skills, practice writing more HTML elements and experiment with Git commands. Keep building and learning!

