What is a Git commit?
Options
- A snapshot of your staged changes, with a message (Correct option)
- Deleting a file from the project working directory
- Sending the code to the production environment
- A branch that is created from the current commit
Answer
A saved snapshot of your staged changes in the project history, with a message describing it
Why
The file history appears as snapshots in time called commits.
You choose what goes in the snapshot with git add, then save it with git commit -m "Fix login error". Each commit has an ID, an author, a date and a message.
Good commits are small and have clear messages in the imperative: 'Add', 'Fix', 'Remove'.
Remember
Commit = a snapshot with a message.