Adding files with `git-add`
When we need to add new files to the repository, we use the git-add command.
$ git add 1-basics.rb
That should return nothing and show the command 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 section in the output and it has our
1-basics.rb file listed as ready “to be committed.” This is the staging area of the git-status output. Files in this area will be included in the next commit.
Let’s do a commit next.