git add Stage changes to include in the next commit
Moves changes from your working folder into the staging area, the draft of your next commit. This lets you commit only the parts you want, not everything at once.
Synopsis
git add [OPTION]... PATH...
Common options
| Option or form | What it does |
|---|---|
PATH | A file or folder to stage. A dot (.) means everything here |
-A, --all | Stage new, changed and deleted files across the whole repository |
-p, --patch | Walk through each change and choose which pieces to stage |
-u | Stage changes to files Git already tracks, but not new files |
-n, --dry-run | Show what would be staged without doing it |
Examples
git add index.html
git add .
git add -p app.js
git add -u
git add --dry-run .
add 'notes.txt'
Notes
- Staging records the file as it is right now. If you edit it again, stage it again before committing.
- Files that match .gitignore are skipped unless you force them with -f.
- To un-stage a file without losing the edit, use git restore --staged FILE.
See also
Last reviewed 2026-10-09.