Commit

A commit is a saved snapshot of your project at a point in time, along with a message describing the change. Commits form the history of a Git repository and each has a unique ID (hash).

Git & DevOps

Making a commit is a two-step process: first you stage the changes you want to include with git add, then you record them with git commit. The message should briefly explain what changed and why.

Each commit points back to the one before it, forming a chain you can browse, revert to, or build branches from.

Syntax

git commit -m "message"

Examples

Bash

git add index.html
git commit -m "Add homepage heading"

Output:

[main 9f3a21c] Add homepage heading
 1 file changed, 3 insertions(+)

Learn it in a lesson

See also

Back to the Dictionary