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
- Stages selected changes in the index before a commit.
- Saves changes in the project's history.
- Creates a new repository.
- 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.
Platforms
- МТУСИ
