Quick Git commit app 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 with complex enterprise workflows
π Configuration-Driven: JSON-based configuration with score-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 "example@example.com" -m "message" --format-go
# Use configuration file to 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 when pushed to origin)
go-commit --amend --force -m "force amend message"Using a configuration file is adaptive 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 the current git remote:
# This creates a go-commit-config.json in current DIR
go-commit config exampleThis file allows you to define signatures with different git remotes:
{
"signatures": [
{
"name": "work-github",
"username": "work-man",
"eddress": "work@corp.com",
"remotePatterns": ["git@github.corp.com:*"]
},
{
"name": "home-github",
"username": "home-dev",
"eddress": "home@example.com",
"remotePatterns": ["git@github.com:home-dev/*"]
}
]
}Examples:
- Project A with remote
git@github.corp.com:team/project-aβ auto commits as work-man(work@corp.com) - Project B with remote
git@github.com:home-dev/project-bβ auto commits as home-dev(home@example.com)
This automatic switching makes multi-project workflow much more convenient.
Validate Configuration:
Once setting up the configuration, you can validate it:
# Check if config loads as expected and preview matched signature
go-commit config -c /path/to/go-commit-config.jsonSee the configuration examples on advanced use cases.
# 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 message
gca -m "new commit message"
# Amend commit when signature info changes (even without code changes)
# Note: gca amends the commit if username/mailbox differs from previous commit
gca
# Force amend (dangerous - use with caution)
gca -m "force update pushed to remote" --force# Stage changes without committing (during testing)
go-commit --no-commit --format-go
# Auto-format Go files and commit with auto-signature
go-commit -m "improve code format" --format-go --auto-sign
# Commit with specific username info (overrides config)
go-commit -u "John Doe" -e "john@corp.com" -m "hotfix" --format-go
# Use mailbox instead of eddress (improved semantics)
go-commit --mailbox "dev@team.com" -m "feature update" --format-go
# Configuration-driven commit (automatic signature based on remote)
go-commit -c ~/go-commit-config.json -m "automated commit" --format-goGit Package Dependencies (Project-Specific Rule):
In this project, we enforce a strict separation between production and test code:
- Production code: Use ONLY
gogit(github.com/go-xlan/gogit) - provides object-based Git operations - Test code: Use
gitgo(github.com/go-xlan/gitgo) - provides chainable operations to set up test conditions
gitgo in production logic code. This rule applies to this project to maintain clean separation of concerns.
MIT License - see LICENSE.
Contributions are welcome! Report bugs, suggest features, and contribute code:
- π Mistake reports? Open an issue on GitHub with reproduction steps
- π‘ Fresh ideas? Create an issue to discuss
- π 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
- 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 merge 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! πππ