git add
The `git add` command stages changes so they will be included in your next commit. You can stage a single file, multiple files, or all changed files at once.
Staging is a required step before committing โ Git will not commit changes that haven't been added to the staging area, even if the file was modified.
git add <file>
git add .
git add -AStaging specific files
Run `git add filename` to stage one file, or list multiple filenames separated by spaces to stage several at once.
Staging everything
Run `git add .` to stage all changes in the current directory and subdirectories, or `git add -A` to stage all changes in the entire repository, including deletions.
git add app.jsStages the single file app.js for the next commit.
git add .Stages all modified and new files in the current directory and below.
Key points
- git add stages a file so it can be committed.
- You can stage single files, multiple files, or all files.
- git add . stages everything in the current directory.
- Files must be staged before git commit will include them.
