Git TutorialLesson 8Free preview
Git Commit
This lesson is part of Git · All levels
Summary
Commit stores snapshots of the staging area into the repository's history, complete with messages, authors, and time. Write a concise commit message in the first line (ideally below 72 characters) in an imperative style such as "add login validation". Git will refuse to commit if there are no changes staged.
Key points
- Git commit -m "message" makes commit from the content of the staging area
- Each commit has a unique hash of 40 hexadecimal characters.
- A good message explains the reasons for change, not just repeats what has changed
- Commit is stored permanently in the object database folder .git
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.