add [June 18, 2011, 2:08 a.m.]
Adding files to a local repository.
Now that we have initialized an empty repository, lets add a couple of files and use Git to index them. For this excercise, we will add a README and LICENSE file to our empty directory. Don't worry about the file contents for now, empty files will do.
cd /home/username/project touch README touch LICENSE
Next, lets ask Git what it thinks of the status of our directory:
git status -s ?? LICENSE ?? README
It looks like Git is unsure about the newly discovered files. We can tell Git to index our files by adding them to the local index:
git add README LICENSE
And now we can see what Git thinks about the directory contents:
git status -s A README A LICENSE
Alternatively, we can use the following commands to add all files in a directory or all files in a directory tree recursively:
git add . git add ..
The only difference is the number of dots. One dot for the current working directory and two dots for the current working directory and all sub-directories.
Further Reading
Git Manual: add
Git Reference: Basic