Git & GitHub Interview Question #7

What is a commit in Git?

Git Fundamentals, Repository, Working Tree, Staging, Commits & Branch Basics Junior Beginner

Quick Interview Answer

A commit is a recorded snapshot of the staged project state together with metadata such as author information, timestamp, message, and a reference to parent commit history. Git identifies commits using object IDs.

Detailed Explanation

A commit is a recorded snapshot of the staged project state together with metadata such as author information, timestamp, message, and a reference to parent commit history. Git identifies commits using object IDs.

Good commits should normally represent a coherent change and have a clear message describing why or what was changed.

Code Example

git add .
git commit -m "Add interview search feature"