Git Commits
A well-structured commit message makes it easier to track changes, collaborate efficiently, and maintain a clean project history. A good commit message follows a consistent format, making it immediately clear what was changed and why. By following a structured naming scheme, developers can quickly understand the purpose of each commit without needing to dive into the code itself.
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 dbe 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
Performance
perf: optimize pathfinding for large maps
perf: reduce draw calls for better rendering efficiency
perf: 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
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.