### **Building Your First Web Page with HTML and Git** #### **Introduction** Creating your first web page can be an exciting journey, and using Git for version control ensures that your progress is tracked efficiently. In this article, you'll learn how to build a basic webpage using HTML and manage your project with Git. Whether you're an absolute beginner or have some experience, this guide will help you understand the fundamentals of web development and version control. #### **What Are HTML and Git?** HTML (HyperText Markup Language) is the backbone of web development. It defines the structure of web pages using elements like headings, paragraphs, links, and images. Git, on the other hand, is a distributed version control system that helps developers track changes in their code. It enables collaboration, rollback to previous versions, and better management of project files. #### **Why Use Git for Version Control?** Version control allows you to: - Keep track of changes to your project. - Revert to previous versions if needed. - Work collaboratively without overwriting each other’s code. - Maintain a clean and organized development process. --- ## **Setting Up the Project** ### **1. Create a Project Folder** To start, create a new folder on your computer where your project files will be stored. You can do this manually or with a terminal command: ```sh mkdir my-first-webpage cd my-first-webpage ``` ### **2. Initialize a Git Repository** Once inside the folder, initialize a Git repository using: ```sh git init ``` This command creates a `.git` directory, which Git uses to track changes. ### **3. Create the First HTML File** Now, create an `index.html` file inside your project folder. This will be the main web page. You can create it manually or use the terminal: ```sh touch index.html ``` --- ## **Writing the HTML Code** Open `index.html` in a text editor (e.g., VS Code, Notepad++, or Sublime Text), and add the following code: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My First Web Page</title> </head> <body> <h1>Welcome to My First Web Page</h1> <p>This is my first attempt at creating a webpage using HTML.</p> <p>Check out my <a href="https://github.com/">GitHub</a> for more projects.</p> </body> </html> ``` This simple structure includes: - A `<head>` section for metadata and the page title. - A `<body>` section containing a heading, paragraphs, and a link. --- ## **Using Git for Version Control** ### **1. Staging and Committing Changes** After writing your HTML code, you need to save it in Git. First, check the status of your files: ```sh git status ``` Next, add the `index.html` file to the staging area: ```sh git add index.html ``` Now, commit your changes with a meaningful message: ```sh git commit -m "Initial commit: Added index.html with basic structure" ``` ### **2. Writing Meaningful Commit Messages** Always use clear commit messages that describe what you changed. For example: ✅ `"Added contact section to index.html"` ❌ `"Updated file"` (Too vague) --- ## **Pushing Code to GitHub (Optional for Advanced Students)** ### **1. Create a GitHub Repository** 1. Go to [GitHub](https://github.com/) and sign in. 2. Click the "+" icon and select "New repository." 3. Name your repository and click "Create repository." ### **2. Connect Your Local Repository to GitHub** In your terminal, run: ```sh git remote add origin https://github.com/your-username/my-first-webpage.git ``` ### **3. Push Your Code to GitHub** ```sh git branch -M main git push -u origin main ``` Now, your project is live on GitHub! --- ## **Conclusion** In this guide, you learned: ✅ How to create a simple web page using HTML. ✅ How to initialize and use Git for version control. ✅ How to push your project to GitHub. The best way to learn is by practicing. Try adding more content to your page and making incremental changes with Git. Happy coding! 🚀