layman/terms
Git words

Commit

kuh · mit

In shortOne saved snapshot of a project in Git, with a short note saying what changed and why.

Building something step by step? Imagine snapping a photo after every step and writing on the back what you just did. Each of those labelled photos is a commit.

When you build a model house, it’s easy to lose track of the steps. Now imagine you take an instant photo after each one and jot a note on a card: “added the walls”, “fixed the wonky window”. Later you can line the photos up and see exactly how the house came together.

In Git, a commit is one of those labelled photos: a saved snapshot of the whole project at one moment, with a short note about what changed.

What’s inside a commit

Small and often

People who write code try to commit small, finished steps rather than one giant change at the end of the week. If something breaks, it’s much easier to spot which small step caused it. It’s also easier to undo just that one.

What it isn’t

Committing isn’t the same as sharing. A commit is saved on your own computer first. Sending it to everyone else (usually on GitHub) is a separate step called pushing.

It also isn’t the same as pressing save in a document. Saving keeps only the latest version. A commit adds a new snapshot to the history and keeps all the old ones too.

Where the comparison breaks down

A photo shows the whole house. A commit can also show precisely what’s different from the one before it, line by line.

How the words fit together

Git keeps the history. Each commit is one snapshot in it. A branch is a separate chain of commits for trying something out. Pushing sends your commits to a shared place like GitHub.

Pro tip

A good commit note says why, not just what. “Fix login” is fine. “Fix login for people with a plus sign in their email” is far more useful six months later.

When you'll hear it

“Did you commit it?” Have you saved that version into the history yet?

“Push your commits.” Send your saved versions up to the shared copy, usually on GitHub, so everyone else gets them.

“Which commit broke it?” Which saved change caused the problem? Git can help track it down.

Say it in a meeting

“What did this change actually do? Can we see the commit?”

Try it yourselfReady to use it? The exact commands are on my other site, devcmds: Save your changes with a commit ↗