git add
git add selects changes to include in the next commit; it does not create the commit yet.
What you will learn
- What the staging area is for
- How to select and review files
Minimal example
git status; git add index.html; git diff --staged; git commit -m "Update the page"Check the status, stage the intended file, review the staged diff, and then commit it.
Common mistakes
git addalone does not save a commit.- Review the staged diff before committing.
- Use a specific path when
git add .would select too much.