Mundhra LabsGitHub, Gently
Stop 3 of 7·6 min read·2 things to try

A commit is a save point with a note

Not every Ctrl+S. A commit is a deliberate of the project, with a short message saying what changed and why.

Comfortable with commits? Skip to stop 4 →

In shortStage what belongs together, commit it with a clear message, and you can always come back to it.

Packing the box

Imagine you're posting a parcel. You edited three files today, but only two belong to the bug you fixed. So you put those two in the box (stage them), write a label (the message), and seal it (commit). The third file waits for its own parcel. The box is called the .

Try it: make a commitTap files to move them in and out of the box

Changed files · not saved yet

The box · staged, git add

History · commits, git commit

Put the two files that fix the date bug in the box, then commit.

You can always go back

Each commit stores the whole project as it was at that moment. So you can open any old version, compare two versions, or undo a change without losing anything. The comparison view is called a diff: green lines were added, red lines were removed.

Try it: travel through historyOne file, four commits

That code under each message, like e05b7c1, is the commit's : its unique ID.

Writing a good message

Your future self, and anyone helping you, reads these. Start with a verb, say what changed, keep it under about 60 characters.

VagueClear
fixFix renewal date showing a day late
changesAdd yearly price to the pricing page
final final v2Remove the old logo files