Skip to content
BENIBIX Learn

Commit

Development🔀 Version ControlGit Basics

Also known as Git Commit

A saved snapshot of your project, with a note saying what changed.

Think of it like

Think of it like a save point in a game. If things go wrong, you can start again from there.

Example

Jack finishes the home page and commits it with the note Add home page. Weeks later he can still see exactly that version.

Why it matters

Commits are the steps of a project's history. Good ones make bugs easy to trace and undo.

Definition

A commit is a saved snapshot of your project at one moment. It holds the staged changes, a short message, the author's name and the time. Each commit gets a unique code, like 93eadff, so you can find it later. Commits link to the one before, which makes a chain that is the project's history. A commit lives only on your computer until you push it.

Example code

console
$ git commit -m "Add home page"
[main (root-commit) 93eadff] Add home page
 1 file changed, 1 insertion(+)
The commit gets the code 93eadff and records one changed file.

Common mistake

Writing messages like stuff or fix. A month later, nobody can tell what that commit did.

Key takeaways

  1. 1
    A snapshot. The project as it was, saved.
  2. 2
    A clear message. Say what changed and why.
  3. 3
    Local until pushed. Others see it only after a push.

Compare

Learn it properly