← All questions
MediumProgramming

What does the git add command do?

TL;DR
Stages selected changes in the index before a commit — option 1.

Question

What does git add do?

Answer choices

  1. Stages selected changes in the index before a commit.
  2. Saves changes in the project's history.
  3. Creates a new repository.
  4. Displays the commit history.

Explanation

git add places selected file content in the index, also called the staging area. The next commit is created from the state of the index.

For example, git add report.txt stages the file's current changes. If you edit it again, those new changes must be staged separately.

git commit records changes in history, git init creates a repository, and git log displays the commit history.

GitStaging areaVersion control

Platforms

  • МТУСИ

Download now and try it for free on your own tasks!

Download for Windows
10 15 free credits • No credit card requiredVersion: Loading…

No installation - download and run. No registration - sign in with Google.