Episode 6 of 12
Making Commits
Learn how to create commits and write good commit messages.
A commit is a snapshot of your project at a specific point in time. Each commit records what changed and who made the change.
Basic Commit
git commit -m "Your commit message here"
Multi-line Commit Messages
git commit -m "Add user authentication" -m "Implements login, registration, and password reset functionality using JWT tokens."
Stage + Commit Shortcut
# Stage all MODIFIED files and commit (won't work for new untracked files)
git commit -am "Fix navigation bug"
Viewing Commit History
# Full log
git log
# Compact one-line log
git log --oneline
# Log with graph
git log --oneline --graph
# Last 5 commits
git log -5
Writing Good Commit Messages
- Do: Start with a verb — "Add", "Fix", "Update", "Remove", "Refactor"
- Do: Keep it under 50 characters for the title
- Do: Be specific — "Fix login button not responding on mobile"
- Don't: "Fixed stuff" or "Changes" or "WIP"
- Don't: List every file changed — Git already tracks that
Good vs Bad Commit Messages
# BAD
git commit -m "updates"
git commit -m "fixed bug"
git commit -m "asdfgh"
# GOOD
git commit -m "Add responsive navbar for mobile devices"
git commit -m "Fix date formatting bug in user profile"
git commit -m "Remove deprecated API endpoints"
Viewing a Specific Commit
git show abc1234 # Shows details of a specific commit