A Git commit is a snapshot of changes recorded in a repository’s history. Each commit represents a specific state of the project at a moment in time. Commits allow developers to track progress, revert mistakes, and collaborate safely. A commit includes metadata such as the author, timestamp, and a descriptive message explaining the change. Commits are immutable, meaning their contents remain fixed once created. They form a chain that tells the complete story of a codebase. Good commit practices make it easier to understand, review, and debug code. Commits also anchor many Git workflows, including branching, merging, and rebasing.
how it works
When a developer stages changes and runs a commit command, Git records the updated files and creates a new object in the repository. Each commit points to one or more parent commits, forming a directed graph. Commit hashes uniquely identify the commit and allow precise referencing. Tools like pull requests and code reviews revolve around commits. Clean, well written commit messages improve communication across teams. AI code assistants benefit from atomic, well scoped commits because they provide clearer historical context.