Menu
Coddy logo textTech

Git Commit

Part of the Version Control section of Coddy's Terminal journey — lesson 11 of 58.

Once changes are staged, you save them to the repository with git commit. Every commit needs a short message that describes what changed.

git commit -m "Add welcome message"

The -m flag (short for message) lets you write the message inline. Without it, Git would open an editor and wait for you to type one.

Good commit messages are short, specific, and written in the imperative tense, like commands you are giving to the codebase:

  • Fix login redirect bug
  • Add dark mode toggle
  • Update README with install steps

After committing, git status reports a clean working tree, and the staged changes are now part of the repository's permanent history.

challenge icon

Challenge

Easy

The folder contains readme.md. Initialize the repo, set the local user name to Coddy Learner and email to learner@coddy.tech, stage the file, and create a commit with the message Initial commit.

End by running git status to confirm the working tree is clean.

Cheat sheet

Save staged changes to the repository with git commit. The -m flag lets you write the message inline:

git commit -m "Add welcome message"

Good commit messages are short, specific, and written in the imperative tense:

  • Fix login redirect bug
  • Add dark mode toggle
  • Update README with install steps

After committing, git status will report a clean working tree.

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Version Control