Golang Conventional Commits... GoCoMmit, goddamit... Gommit!
Because following specs shouldn't be so commit-ting. Conventional Commits made easy anywhere, gommit! 💢
Gommit! is a powerful tool for enforcing consistent commit message formats in your Git repositories. It helps teams maintain clean and informative commit histories by validating commit messages against predefined rules.
- Enforces the Conventional Commits specification
- Automatically sets up in repositories with zero configuration for developers
- Cross-platform support (Linux, macOS, Windows)
- Easy integration for repository maintainers
To quickly integrate Gommit! into your repository, follow these steps:
-
Run the appropriate convenience script for your operating system:
If you have
curlinstalled:sh -c "$(curl -L "https://raw.githubusercontent.com/moukrea/gommit/main/integration/integration.sh")"If you have
wgetinstalled:sh -c "$(wget -O- "https://raw.githubusercontent.com/moukrea/gommit/main/integration/integration.sh")"If you have
fetchinstalled (common on FreeBSD):sh -c "$(fetch -o - "https://raw.githubusercontent.com/moukrea/gommit/main/integration/integration.sh")"Run the following command in PowerShell:
powershell -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/moukrea/gommit/main/integration/integration.ps1'))"
-
After running the convenience script, review the changes made to your repository.
-
Add and commit the new files:
git add .gommit Makefile git commit -m "chore(hooks): integrate gommit" -
Push the changes to your repository:
git push
-
Update your repository's documentation to inform developers about Gommit. Add the following to your
README.mdorCONTRIBUTING.md:## Setting up Gommit! This repository uses [Gommit!](https://github.com/moukrea/gommit) to enforce consistent commit message formats. After cloning the repository, run the following command to set up Gommit: `make gommit-setup` This will download the appropriate Gommit! binary for your system and set up the necessary Git hooks.
These steps ensure that Gommit! is properly integrated into your repository and that developers have clear instructions for setting it up.
For those who prefer to set up Gommit! manually or want to understand the integration process in detail, please refer to our Manual Integration Guide.
The integration tool adds the following to your repository:
.gommit/: A directory containing Gommit! setup scripts for various platformsMakefile: A Makefile with a target for setting up Gommit! (or appends to your existing Makefile)
These additions ensure that Gommit! can be easily set up by developers who clone your repository.
When you clone a repository that has Gommit! integrated, you'll need to set it up locally. This is typically done by running:
make gommit-setup
This command will download the appropriate Gommit! binary for your system and set up the necessary Git hooks.
When you make a commit, Gommit! will validate your commit message. A valid commit message should follow this format:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Where <type> is one of:
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests or correcting existing tests
- chore: Changes to the build process or auxiliary tools and libraries such as documentation generation
For example:
feat(user-auth): add password reset functionality
- Implement password reset form
- Add email sending service for reset links
- Update user model with reset token field
Closes #123
If your commit message doesn't meet the required format, Gommit! will prevent the commit and provide feedback on what needs to be corrected.
Contributions to Gommit! are welcome! Please see our Contributing Guidelines for more details.
Gommit! is released under the MIT License. See the LICENSE file for details.
Gommit can be customized to fit your project's specific needs. You can configure various aspects of commit message validation, including:
- Header format and length
- Description case
- Body line length
- Footer format
- Breaking change enforcement
For detailed information on how to create, use, and customize the configuration file, please refer to our Configuration Guide.
If you encounter any problems or have any questions, please open an issue on our GitHub repository.
Thank you for using Gommit! to keep your commit history clean and informative!
Repository image uses OpenMoji emojis, licensed under CC BY-SA 4.0
Note: This project was developed with assistance from AI tools (aider.chat, OpenRouter with Claude 3.5 Sonnet, GPT-4o and GPT-o1 preview).
