In this week's practice exercise, we're going to reinforce the skills acquired in this week's class by creating and modifying a GitHub repository, using as much command-line as possible along the way.

Creating a Repo

Begin by creating a brand-new GitHub repository in your GitHub account. Call it shopping-list, and keep the repository public. Then, open the repository in using Gitpod.

Open the Terminal in Gitpod – hamburger menu -> View -> Terminal. The current working directory should be /workspace/shopping-list, but if it isn't, you can cd into that directory. Create a new file called README.md by typing touch README.md at the prompt. You should see it appear in the Explorer in the left-hand sidebar. Click on the file in Explorer to open it.

Edit the README.md file and add a bulleted list of items to purchase. This can be a list of anything you want, with each item on its own line, and each line starting with a dash and a space. Like this:

- Bacon
- Eggs
- Xbox

Commit your changes using the Source Control pane on the left-hand side. Add a meaningful commit message, such as "adds initial list of items". Then, click on the three dots under Source Control, and choose "Push".

This will publish your initial code to GitHub. Head back over to the repository page on GitHub.com, and you should see your code there, complete with commit message and list of files (there should only be one). Because you named the file README.md, the contents of the file should appear on the repository's home page.

Push changes

Head back to Gitpod. Next, add a few items to your shopping list. Then, commit the changes (with a good commit message describing the work), and sync the changes to GitHub.

After syncing, go back to the repository page on GitHub.com, and refresh. Notice how the changes you've made have affected the repository. At this point, feel free to poke around and see how Git and GitHub track your changes. For example, click on your latest commit message to see how GitHub presents a visual of the changes you made in that commit.

Add files

Use the Explorer in Gitpod to upload an image file from your computer. Right-click in the Explorer and select Upload..., then select the file from your computer. The file will be uploaded and appear in your Explorer. Then, commit and sync your changes.

Head back to GitHub.com and see how those changes have affected the online repository.

Let's decide that images belong in a sub-directory called images. Head back to the Gitpod Terminal, and create the directory:

mkdir images

Then, move the image you uploaded into the newly created images directory. If the image you uploaded was called bacon.jpg, you would do:

mv bacon.jpg images

(Of course, we can do this using the mouse and the graphical interface within Gitpod; we just want practice using the command-line instead.)

Finally, commit and sync to GitHub, view the repository at GitHub.com, and verify how the repository contents have changed.