git add
Adds file contents to the staging area (index) for the next commit.
Syntax
git add [<pathspec>...]
Options
- pathspec: Files or directories to add. Use . to add all changes
- -A / --all: Stages all changes (new, modified, deleted)
- -p / --patch: Interactively choose hunks to stage
- -n / --dry-run: Show what would be added without actually adding
Example
git add . git add src/app.ts git add -p
Tip
Use git add -p to review and stage individual changes within files.