Prefixing Git commits
I recently began incorporating prefixes into my Git commits to add more context to them.
The prefixes I used last week are:
- feat: when developing a new feature
- fix: for correcting an error
- chore: when changing configuration or renaming files
- test: for tasks related to testing
- docs: when documenting something, for example in the README.md
- refactor: for restructuring existing code without changing its external behavior
- post: for adding a new blog entry
When I prefix a Git commit, I use lowercase for the prefix, followed by a message that starts with a capitalized letter. Finally, I include a reference to the related issue. For example:
feat: Show a message to the user indicating successful sign-in (#15)
I believe this is a good practice, and I’ve seen it used in other open-source project on GitHub, so I’ve added it to my workflow. I’ll be incorporating more prefixes if I find others that could be useful to me.
Recent Git prefixes used
- feat: when developing a new feature
- fix: for correcting an error
- chore: when changing configuration or renaming files
- test: for tasks related to testing
- docs: when documenting, e.g., in README.md
- refactor: to restructure code without altering its functionality
- post: for adding a new blog entry