Git · Everyday workflow

git commit

Records staged changes. The message should explain why the change exists, not repeat the diff.

Syntax
git commit -m "Explain why"

Example

Example
git add src/app.ts
git commit -m "fix: keep the sidebar open on mobile"

More in this group

git add git blame git commit --amend git diff git fetch git log git mv git pull

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course