What is the difference between git add and git commit?

git addgit commit
Moves changes to the staging areaSaves the staged changes as a snapshot in the repository
Can be used many times before a commitCreates a permanent point in the history
Has no messageNeeds a message (-m)
Changes can be unstaged with git restore --stagedCan 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
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.