Git & GitHub Interview Question #14
What does git commit do?
Git Fundamentals, Repository, Working Tree, Staging, Commits & Branch Basics Junior Beginner
Quick Interview Answer
git commit creates a new commit from the content currently in the staging area. The commit becomes part of the current branch history.
Detailed Explanation
git commit creates a new commit from the content currently in the staging area. The commit becomes part of the current branch history.
A commit is local until it is pushed to a remote. Unstaged working-directory changes are normally not included merely because git commit was run.
Code Example
git commit -m "Add Git interview questions"