Quick Git commit tool with auto Go changed code formatting capabilities.
🎯 Quick Commit Automation: Intelligent staging, formatting, and committing with amend support
⚡ Auto Go Formatting: Selective formatting of changed Go files with generated file exclusion
🔄 Signature-info Management: Automatic Git signature selection based on remote URL patterns
🌍 Wildcard Patterns: Sophisticated pattern matching for complex enterprise workflows
📋 Configuration-Driven: JSON-based configuration with priority-based signature matching
go install github.com/go-mate/go-commit/cmd/go-commit@latest
# Quick commit with Go formatting
go-commit -m "some commit message" --format-go
# With signature info
go-commit -u "username" -e "[email protected]" -m "message" --format-go
# Use configuration file for auto choose signature info
go-commit -c "xx/xx/go-commit-config.json" -m "commit message" --format-go
# Amend previous commit
go-commit --amend -m "updated message" --format-go
# Force amend (even pushed to origin)
go-commit --amend --force -m "force amend message"
Using a configuration file is optional but enables advanced features like automatic signature switching based on the project's remote URL.
To get started, you can generate a configuration template based on your current git remote:
# This creates a go-commit-config.json in your current directory
go-commit config example
This file allows you to define signatures for different git remotes. It looks like this:
{
"signatures": [
{
"name": "work-github", "username": "work-user", "eddress": "[email protected]", "remotePatterns": [
"[email protected]:*"
]
},
{
"name": "play-github", "username": "play-user", "eddress": "[email protected]", "remotePatterns": [
"[email protected]:play-user/*"
]
}
]
}
Examples:
- Project A with remote
[email protected]:team/project-a
→ auto commits as work-user([email protected]) - Project B with remote
[email protected]:play-user/project-b
→ auto commits as play-user([email protected])
This automatic switching makes multi-project workflow much more convenient.
Validate Configuration:
Once setting up your configuration, you can validate it:
# Check if config loads correctly and preview matched signature
go-commit config -c /path/to/go-commit-config.json
More advanced use cases. See the configuration examples.
# Quick commit with formatting
alias gcm='go-commit --username=yourname --format-go'
# Quick amend with formatting (extends gcm)
alias gca='gcm --amend'
# Commit with message and Go formatting
gcm -m "add new feature"
# Amend last commit
gca
# Change last commit
gca -m "new commit message"
# Force amend (dangerous - use with caution)
gca -m "force update pushed to remote" --force
MIT License. See LICENSE.
Contributions are welcome! Report bugs, suggest features, and contribute code:
- 🐛 Found a bug? Open an issue on GitHub with reproduction steps
- 💡 Have a feature idea? Create an issue to discuss the suggestion
- 📖 Documentation confusing? Report it so we can improve
- 🚀 Need new features? Share the use cases to help us understand requirements
- ⚡ Performance issue? Help us optimize through reporting slow operations
- 🔧 Configuration problem? Ask questions about complex setups
- 📢 Follow project progress? Watch the repo to get new releases and features
- 🌟 Success stories? Share how this package improved the workflow
- 💬 Feedback? We welcome suggestions and comments
New code contributions, follow this process:
- Fork: Fork the repo on GitHub (using the webpage UI).
- Clone: Clone the forked project (
git clone https://github.com/yourname/repo-name.git
). - Navigate: Navigate to the cloned project (
cd repo-name
) - Branch: Create a feature branch (
git checkout -b feature/xxx
). - Code: Implement the changes with comprehensive tests
- Testing: (Golang project) Ensure tests pass (
go test ./...
) and follow Go code style conventions - Documentation: Update documentation to support client-facing changes and use significant commit messages
- Stage: Stage changes (
git add .
) - Commit: Commit changes (
git commit -m "Add feature xxx"
) ensuring backward compatible code - Push: Push to the branch (
git push origin feature/xxx
). - PR: Open a pull request on GitHub (on the GitHub webpage) with detailed description.
Please ensure tests pass and include relevant documentation updates.
Welcome to contribute to this project via submitting merge requests and reporting issues.
Project Support:
- ⭐ Give GitHub stars if this project helps you
- 🤝 Share with teammates and (golang) programming friends
- 📝 Write tech blogs about development tools and workflows - we provide content writing support
- 🌟 Join the ecosystem - committed to supporting open source and the (golang) development scene
Have Fun Coding with this package! 🎉