What is a commit in Git and what information does it actually store?
Published on 2026-10-20 by frfrand
What a Git commit does, why it has an identifier, how to write useful messages, and what mistakes to avoid when saving changes.

Short answer: 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 stores a reference to the file tree, its parent commit, the author, the date, and a message, and is identified by a hash.
It is not the same as saving the file with Ctrl+S: it is a history unit that you can consult, compare, and share.
The example of renovation photos
Imagine you are renovating 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 really 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 the history. It includes author data, date, committer, and a message.
The history forms a connected structure: it allows you to follow 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 path 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 someone investigates a failure six months later. "Fixes double reservation 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 settings.
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
Include passwords: if a key reaches 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 you deploy a GitHub repository in ArduMaker, the deploy history records from which commit to which commit each one went, who or what triggered it, and how each phase ended. This helps investigate regressions and know 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.

From a commit to a deployment in ArduMaker
A simple example of the Git flow is changing the validation of an API, creating a commit with a descriptive message, pushing it to GitHub, and verifying that the expected branch contains that change. Then, when deploying the repository from GitHub with ArduMaker, the deployment history records the published commit and the previous one.
This allows answering two common questions during an incident: what version was published? and what changed compared to the previous one?. If an update introduces an error, comparing both commits helps identify the modifications. And ArduMaker's rollback returns to the commit from a previous deployment that worked well, without touching the database.
A commit does not by itself equal a publication: it can exist locally or on GitHub without the production version having changed, unless the repository has automatic deployment enabled: then every push to the chosen branch triggers a deployment. It also does not guarantee that tests were run. Keep the commit, review, testing, and deployment stages separate.
To learn more, consult the deployment documentation from GitHub and the article about pull requests.
Frequently asked questions
What is the difference between git add and git commit? git add stages changes in the staging area; git commit records in the history what is staged. What you did not add does not enter the commit.
Can I change the message of the last commit? Yes, with git commit --amend. This creates a new commit with another identifier, so avoid it if you already sent it to a branch that other people use.
Does deleting a password in a new commit remove it? No. It remains in the history. You must revoke it and generate a new one.