How do you add changes to the staging area in Git?

How do you add changes to the staging area in Git?

a) git add
b) git commit
c) git stage
d) git push

Answer:

a) git add

Explanation:

The git add command is used to add changes to the staging area in Git. This prepares the files for the next commit. You can add individual files, multiple files, or all changes using commands like git add filename or git add . to stage everything.

Staging allows you to control which changes will be committed. It’s a useful feature for managing and organizing changes before creating a commit.

Using git add effectively ensures that only the intended changes are included in each commit, maintaining a clean project history.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top