4. Making changes
Goals
- Learn to monitor the working directory’s state.
01 Changing the “Hello, World” page
Let's add some HTML-tags to our greeting. Change the file contents to:
File: hello.html
<h1>Hello, World!</h1>
02 Checking the status
Check the working directory’s status.
Run
git status
You will see:
Result
$ git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <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
.