5. Staging the changes

Goals

  • Learn to stage changes for the upcoming commits.

01 Adding changes

Now command Git to stage changes. Check the status:

Run

git add hello.html
git status

You will see:

Result

$ git add hello.html
$ git status
On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   hello.html

Changes to the hello.html have been staged. This means that Git knows about the change, but it is not permanent in the repository. The next commit will include the changes staged.

Should you decide not to commit the change, the status command will remind you that you can use the git reset command to unstage these changes.