O'Reilly logo

Pragmatic Version Control Using Git by Travis Swicegood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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"
 
Created initial commit 7b1558c: add in hello world HTML
 
1 files changed, 5 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required