Staging Changed Files

We've committed our first version of medals.html to our repository. But medals.html doesn't include a link to bronze.html right now, so users of the site will have no way to find that page. We'll need to edit medals.html to add that link, and commit those changes as well.

Add the following code to medals.html:

<div>
<a href="bronze.html">Bronze medals</a>
</div>

Be sure to save your changes after editing the file.

Don't worry if you don't understand all that. If you want, you can learn more about HTML in this course.

Now, we need to commit our changes to the file.

We've modified the medals.html file. Let's see what its status is, with the git status command: git status

There's a new section, "Changes not staged for commit". This is where changes to tracked files will appear.

The two changes are totally unrelated. It would probably be best to handle them as two separate commits. But if all modified files were always committed, that wouldn't be possible. I'd have to undo changes to one file before I could make a commit.

But that's why Git has a staging area. It allows you to select individual modified files to be part of a commit, while leaving other modified files to be part of a separate commit.

That means that if I want, I can stage and commit only the bronze.html file: