Summary
To stage all of the files in your current directory, enter the following command in your terminal:
git add .
To stage a particular file, enter the following command in your terminal:
git add file-name
Details
To check if the right files were staged correctly, enter the following command in your terminal:
git status
You should see the files you added underneath the section called “Changes to be committed:”. For example, if you’ve staged your README.md
file, you should something similar to the following output (you may be on a different branch):
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: README.md
Exercises
Run the git add .
command from the Summary to stage your files.
References
Pro Git book on the official Git website (see the section called “Initializing a Repository in an Existing Directory”)