Commits and Repository History

A commit represents a recorded snapshot of the project's state. Each commit has an identifier, author information, timestamp, message, parent relationship, and references to the content tree.

Good commit messages describe the intent of the change. Prefer small, logical commits such as Fix token expiration validation instead of vague messages such as changes.

Inspect Commit History
git log
git log --oneline --decorate --graph --all
git show HEAD
git show HEAD~1
💡 git log displays history, while git show displays the details of a particular commit. HEAD~1 refers to the first parent of the current commit.
Key Takeaways
  • Commits form a directed history through parent relationships.
  • Useful commit messages communicate intent.
  • Graph views make branches and merges easier to understand.
Knowledge Check

What does HEAD normally identify?