3.2 Making Changes

Now that we have an empty repository, it’s time to add a file to it. Create a file called index.html and add a header with the text “Hello World” in it. It should look something like this:

 
<html>
 
<body>
 
<h1>Hello World!</h1>
 
</body>
 
</html>

This gives us a basic HTML page to start tracking. We’ll add some more to it as we continue. Now that we have this file, it’s time to tell Git we want to track it. This is a two-step process. First we have to tell Git to add the file to its index using the command git add; then we create a commit using git commit.

 
​prompt> git add index.html
 
​prompt> git commit -m "add in hello world HTML"

Get Pragmatic Version Control Using Git now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.