Loading...

Git Tutorial

Making changes in git

To learn to monitor the working directory’s state

Step1:Changing the “Hello, World” page

Let’s add some HTML-tags to our greeting. Change the file contents to:

FILE: hello.html

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

Step2:Checking the status

Check the working directory’s status.

RUN:

git status

You will see …

RESULT:

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   hello.html
#
no changes added to commit (use "git add" and/or "git commit -a")

The first important aspect here is that git knows hello.html file has been changed, but these changes are not yet committed to the repository.

Another aspect is that the status message hints about what to do next. If you want to add these changes to the repository, use git add. To undo the changes use git checkout.