1.2 Working Tree, Staging Area, and Commit
The most confusing part of Git for beginners is that "saving history" is split into two steps: stage first, then commit.
Working tree
The working tree is the project files you see in your editor. Editing README.md, creating style.css, or deleting an image all happen in the working tree first.
git statusgit status tells you which files changed, which files are untracked, and which changes are already staged.
Staging area
The staging area, also called the index, is the preparation area for the next commit. You can choose only some files for the next commit.
git add README.md
git add style.cssThis is not a commit and not an upload. It only means, "Include these changes in the next commit."
Commit
A commit saves the staged content as a new history node.
git commit -m "Add project README"A good commit message should describe the purpose of the change, not just say update or fix.
git add, that edit will not automatically enter the next commit. A commit saves the staging area, not the whole working tree.