What is a commit in Git and what information does it actually store?
Published on 2026-10-20 by frfrand
Qué hace un commit de Git, por qué tiene identificador, cómo escribir mensajes útiles y qué errores evitar al guardar cambios.

A Git commit is a record of a project state, accompanied by information about who created that record, when, and how it relates to previous history. It is not equivalent to saving the file with Ctrl+S: it is a history unit that you can consult, compare, and share.
The example of renovation photos
Imagine that you renovate a room. Every day you take a photo to remember how it looked before moving the furniture. If something goes wrong, you look at the photos and understand what changed. Git works with a similar idea, but it stores references to content objects and metadata efficiently, instead of naively copying an entire folder every time.
A commit has an identifier, commonly represented by a hexadecimal hash. That identifier depends on the content of the commit object, including its reference to the file tree and its metadata. That is why changing the message or the history can result in another identifier.
What does it actually contain?
Each commit references a tree that describes the state of versioned files and directories. It also points to one or more parent commits, except at the beginning of history. It includes author data, date, committer, and a message.
History forms a connected structure: it allows following the path from one version to its predecessors. A commit is not necessarily "the changes" in the literal sense, although Git can calculate the difference between two states.
How to create one without mixing everything
A common walkthrough is:
git status
git add src/app.py
git diff --cached
git commit -m "Corrige validación de reservas"
First you check the repository status, add only what you want to include, inspect the staging area, and only then confirm the commit.
The staging area, called staging area or index, is important: it allows you to save a change into two different commits if you solved two independent problems.
What is a good message?
"Changes" or "fixes" say very little when six months later someone investigates a failure. "Fixes double booking when confirming appointment" explains the intention better.
A good commit usually groups a coherent change. It doesn't have to be tiny, but it does have to be understandable and reviewable. If you modified the database, button design, and authentication, they might deserve different commits.
Is a commit already on GitHub?
No. git commit records the change in the repository where you work. To share it with a remote, you normally use git push, following branch and permission configuration.
It is also worth remembering that Git is not a sufficient backup by itself. A local repository that was never sent to another place can be lost with the disk.
Errors that cause real problems
Including passwords: if a key reaches the history, deleting the line in the next commit does not automatically remove previous exposure. You must revoke and rotate secrets.
Confirm generated files without criteria: some artifacts should be versioned and others should not; decide according to how the project is built.
Modify published commits without coordinating: rewriting shared history can disrupt other people's work.
How it applies in ArduMaker?
When deploying projects from Git repositories in ArduMaker, knowing which commit was associated with a version helps investigate regressions and understand exactly what code was published. It does not replace testing, but it greatly improves traceability.
In summary: a commit is an identifiable point in the code history. Make small and clear commits, review what they include, and avoid uploading secrets.
Sources: Official git-commit documentation · Staging area in Pro Git.
