Commit: A saved snapshot of your changes in Git, with a short message describing what you changed and why. Each commit has a unique ID and becomes part of the project's history.
Example
You fix a validation bug, check your changes, and commit them with the message "Fix crash when email field is empty on signup". Your mentor can later see exactly what changed in that commit.
How Committing Works
- Change files in your working folder.
- Choose which changes to include with git add (this is called staging).
- Save them with git commit -m "message".
- The commit exists only on your machine until you push it.
Writing Good Commit Messages
| Weak message | Better message |
|---|---|
| fix | Fix crash when email field is empty on signup |
| changes | Add pagination to the orders API |
| final code | Update product search to ignore case |
Start with a verb, describe what changed, and keep the first line short. Some teams add the ticket number, such as PROJ-142.
Good Commit Habits
- Commit small, related changes together; one logical change per commit.
- Review what you are committing with git diff or your IDE first.
- Never commit passwords, API keys, or large build files. Use a .gitignore.
- Commit often enough that you don't lose work, but don't commit broken code to shared branches.
Related terms
- Push: sends your commits to the remote repository.
- Repository: stores all commits as history.
- .gitignore: keeps unwanted files out of commits.
- Pull Request (PR): groups your commits for review.
Previous term: Collaboration | Next term: Communication
Related guides
- Build a GitHub Portfolio That Gets You Internship Interviews
- What to Do in Your First Week of an IT Internship
- DevOps Interview Questions Test
Frequently asked questions
What is a commit in Git?
A commit is a saved snapshot of your changes, with a message describing them, recorded in the repository's history.
What is the difference between commit and push?
A commit saves changes in your local repository. A push sends those commits to the shared remote repository.
How often should I commit?
Whenever you finish a small, logical piece of work that compiles and makes sense on its own.
Can I undo a commit?
Yes, with commands such as git revert or git reset, but be careful with commits you have already pushed. Ask a teammate if unsure.
Explore more internship terms
The IT Internship Glossary explains 199 terms you will hear before and during your internship, with simple definitions and real examples.
Browse all 199 terms