What is the difference between git add and git commit?
| git add | git commit |
|---|---|
| Moves changes to the staging area | Saves the staged changes as a snapshot in the repository |
| Can be used many times before a commit | Creates a permanent point in the history |
| Has no message | Needs a message (-m) |
Changes can be unstaged with git restore --staged | Can be undone with git reset or git revert |
Normal order: edit files, git add, then git commit. See Git Add and Git Commit.
Learn more about the similar topics:
| Tutorials |
|---|
| Git Init |
| Git Status |
| Git Add |
| Git Commit |
| Git Log |
| Git Diff |
| Git Ignore (.gitignore) |