Naming Git commits can sometimes feel like a waste of time, especially when you’re deep in the trenches of coding and racing against a deadline. Thinking of a good commit title and description can be so mentally taxing that the best we can come up with is “I fixed it.”
To streamline the process and avoid overthinking each commit, I’ve developed a simple naming convention that keeps your Git history clear and professional while quickly communicating the purpose of each change.
Commit Message Breakdown
Each commit message should follow this format:
<type>: <short description>
<body> (optional)
- Title (Type + Description): A concise summary of the change.
- Body (Optional): A more detailed explanation if necessary.
Example:
fix: resolve login form validation error
Corrected the email validation logic that incorrectly rejected valid email formats. Updated test cases to cover edge cases.
Example Naming Scheme
The following provides examples of git commit titles for different types of tasks. Note that the task type is usually abbreviated and followed by a colon with a short blurb. More detailed information should be provided in the commit description.
Initialization
init: setup Unity project with basic structure
init: initialize repo with README and .gitignore
Feature
feat: add health regeneration system
feat: implement player skill tree
feat: introduce AI behavior for enemy patrols
Fix
fix: resolve null reference in player controller
fix: correct enemy spawn timing in Level 3
fix: adjust jump physics to prevent unintended movement
Documentation
docs: update README with setup instructions
docs: add comments to AI scripts
docs: document interaction flow for puzzle levels
Refactor
refactor: simplify inventory system logic
refactor: improve AI decision-making efficiency
refactor: reorganize asset folders for clarity
Test
test: add unit tests for inventory system
test: validate AI behavior in combat scenarios
test: playtest difficulty scaling for boss fights
Maintenance
chore: update Unity to latest version
chore: remove deprecated scripts
chore: clean up unused assets
Optimization /Performance
opt: optimize pathfinding for large maps
opt: reduce draw calls for better rendering efficiency
opt: compress textures to reduce file size
Build
build: configure WebGL build settings
build: automate build process with CI pipeline
build: verify level loading order in final build
Revert
revert: undo AI system changes due to performance issues
revert: restore previous enemy pathfinding logic
revert: rollback incorrect texture update
Hotfix (Emergency Fixes)
hotfix: fix crash on level load
hotfix: resolve broken player input on mobile
hotfix: patch exploit in matchmaking system
Squish Commits
While following a commit naming scheme is a best practice, rapid debugging or experimentation can lead to cluttered commit messages like “IT FINALLY WORKS” or “I HAVE NO IDEA WHAT HAPPENED.” Though these may capture the moment, they don’t help maintain a clear version history. In these cases, squashing commits lets you merge multiple commits into one, ensuring a clean, professional history that follows the proper naming convention.
I hope these examples and the commit naming scheme help make your Git history clearer, more professional, and easier to navigate. By following a consistent format, you can save time, improve collaboration, and quickly understand the purpose of each change, without having to overthink every commit.