✏️ 1.1.1.4 Practice: Command Line Git
Goal: Here at Fidgetech, we use the command line, Git and Github on a daily basis. The goal for this exercise is to practice the workflow you'll use daily.
Warm Up
Ask yourself the following questions before moving on:
- What are the steps to make a Git commit?
- What is the significance of the word 'main' in the command
$ git push al main? - What is the difference between the local
.gitrepository, and the repository created on Github? - How are the local
.gitrepository, and the repository created on Github 'connected'?
AI Support: Stuck on a command line error like
command not foundorno such file or directory? After trying the steps below, you can ask AI to explain what a command does or interpret an error in plain language. You can ask AI to clarify terminal errors and Git workflow steps. Do not ask AI to complete this exercise or write your HTML for you.Example prompts:
- Weak: "Why isn't this working?"
- Strong: "I ran
cd Desktopand got 'no such file or directory.' What are 2–3 things I should check about my current directory?"Before asking, check: Do I have the license for this? See Using AI Responsibly at Fidgetech and How to Ask for Help.
Try asking AI: "I'm building a new project from scratch. Can you list the Git steps in order—from
mkdirtogit push—without writing the commands for me?"After reading AI's response, walk through the steps out loud before you start coding.
Code
Goodbye World
Begin practicing the command line, Git commands and GitHub set up by building a "Goodbye World" web page that you push to a repository on GitHub. The steps you need to complete are below. You will need to use the previous lessons as reference for the correct syntax and commands to complete them.
- Create a new project directory in the Desktop directory called
goodbye. - Initialize a Git repository to start tracking your changes.
- Create an HTML file called
goodbye.html. - Open your project directory in your text editor.
- Add this HTML code to your
goodbye.htmlfile:
<h1>Goodbye</h1>
<h2>A program to bid our friends farewell all over the world.</h2>
<ul>
<li>English: Goodbye, friends!</li>
<li>Spanish: Adios, amigos!</li>
</ul>
- Save the file and look at it in your browser.
- Check the status of the changes that Git is watching.
- Add the HTML file for tracking.
- Commit your changes.
- Add a few more lines of goodbyes to your HTML file (copy an existing line and write over the text leaving the
<li>and</li>at the beginning and end of the lines). - Save the file and commit your changes.
- Create a GitHub repository.
- Push your changes to GitHub.
Checkpoint
Before moving on, you should be able to:
- Create a new project from scratch using the terminal, Git, and your text editor
- Make at least two commits with clear messages and push to GitHub
- Complete the full workflow without copying commands blindly
If you're unsure, re-read the previous lessons or ask AI: "I'm building a new project from scratch. Can you list the Git steps in order—from mkdir to git push—without writing the commands for me?"