Adding files with `git-add`

When we need to add new files to the repos­i­to­ry, we use the git-add command.

$ git add 1-basics.rb

That should return noth­ing and show the com­mand prompt. That means it was successful. 

If we run git-status again we can see that it worked:

$ git status
On branch master
	
  Initial commit
	
  Changes to be committed:
    (use "git rm --cached <file>..." to unstage)
	
    new file:   1-basics.rb
	
  Untracked files:
    (use "git add <file>..." to include in what will be committed)
	
		.gitignore
		2-expressions_and_operators.rb
		3-objects_and_classes.rb
		4-inheritance.rb
		5-modules_and_mixins.rb
		README.md

There’s a new sec­tion in the out­put and it has our 1-basics.rb file list­ed as ready to be com­mit­ted.” This is the stag­ing area of the git-sta­tus out­put. Files in this area will be includ­ed in the next commit.

Let’s do a com­mit next.