Skip to content

git add#

By adding the file to the staging area, we get it ready to be committed into the repository's final commit log:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$ git add hello.txt

$ git status
On branch master

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
    new file:   hello.txt

We used git add to add the hello.txt file to the staging area. Our status now shows us something different: we have "changes to be committed":

1
new file:   hello.txt

And we can see a new command (that you're encouraged to experiment with) that can remove the file from the staging area: "use git rm --cached <file>... to unstage".

Now that we have something inside of our staging area, we can commit it. Let's review the git commit command.