How do you commit changes in Git?

How do you commit changes in Git?

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

Answer:

b) git commit

Explanation:

The git commit command is used to save changes to the local repository. After staging changes with git add, you can use git commit -m "message" to create a commit with a message describing the changes.

Each commit is a snapshot of the project’s state at a particular point in time, allowing you to track changes and revert to earlier versions if needed.

Frequent, descriptive commits make it easier to manage and collaborate on projects, providing a clear history of development.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top