Overview
Suppose a repository contains two modified files and one new folder containing a new file. Git status may report the older files as modified and the new folder as untracked.
To stage every change across the repository, use either:
git add --all
or:
git add -A
These two forms perform the same role in the workflow described here: they stage all detected changes across the project.
To stage changes under the current directory, use:
git add .
The dot means the current directory and everything beneath it. The command's scope therefore depends on where you are when you run it.
If you run git add . from the repository root, it can stage changes throughout the project tree. If you first enter a subdirectory and run the same command there, only changes in that directory and its descendants are selected.
The asterisk form behaves differently:
git add *
In the demonstrated workflow, this stages visible new or modified paths matched from the current directory, but a deleted file remains unstaged. This makes the asterisk form less complete than --all, -A, or a correctly scoped dot when deletions must also be included.
You can also stage a specific file:
git add 1.txt
Or a file at a path:
git add my-folder/3.txt
A filename pattern can select files by extension in the current directory:
git add *.txt
In the demonstrated use, this stages matching text files in the current directory, while files in nested folders and deleted files are not included by that pattern.