A commit in Git is a fact carved in stone. Once created, it does not change. This is Git immutability—the core guarantee that your project’s history is safe from silent rewrites and hidden edits.
Git immutability means every commit is identified by a SHA-1 (or SHA-256 in newer versions) hash derived from its contents and metadata. Change the code, author, timestamp, or parent commit, and the hash changes. This cryptographic fingerprint ensures that if a commit matches a given hash, it is exactly the same as when it was first recorded.
The concept extends throughout Git’s object model. Commits, trees, and blobs are immutable objects stored in the .git directory. When you work on a branch, you are only adding new commits on top, never editing existing ones unless you run commands that explicitly rewrite history.
Immutability provides integrity. It enables distributed collaboration without fear. If someone tampers with past commits, Git detects it through hash verification. This property allows teams to trust the repository state whether it lives locally, on a server, or in a mirror halfway across the world.