What is a commit in Git?
Short answer: A commit in Git is a snapshot of your project at a specific point in time.
Explain a bit more
It records all the changes you've made to the files and saves them to the repository. Every commit has a unique ID, and it's like a save point in a video game—if something breaks, you can go back to any commit. Real-World Example: Let’s say you fixed a bug on the homepage of your app. After completing the fix, you commit the changes to the repository. Later, if the fix causes an issue, you can roll back to the previous commit.
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png