WEEK 7 · LESSON 4 · TOPIC 2 OF 11 · How It Works

How It Works

Lesson progress

0% Complete

SECTION 1 OF 1

In this topic · 1 sections
  1. Overview

Overview

After staging the intended changes, create a commit with:

git commit -m "Describe the change"

The -m flag supplies a short commit message. The message should identify what the saved change represents so that the history remains understandable.

When Git is used for the first time on a computer, it may refuse to commit until the author's identity is configured. Git needs a name and email because this information is attached to commits.

Configure the identity for the computer with:

git config --global user.email "your-email@example.com"
git config --global user.name "Your Name"

The --global flag applies the configuration across repositories on that computer.

To use repository-specific identity settings instead, use local configuration:

git config --local user.email "your-email@example.com"
git config --local user.name "Your Name"

After a successful commit, Git reports a summary such as the number of files changed and lines added or removed. Running git status should then show a clean working tree if no new edits remain.