Thank you for your interest in contributing to Gitmit! This document provides guidelines and information for contributors.
Gitmit aims to be:
- Fast and lightweight: Minimal dependencies, quick analysis
- Privacy-focused: Complete offline operation
- Professional: Industry-standard commit message format
- User-friendly: Simple CLI interface with helpful prompts
- Reliable: Consistent and predictable behavior
- Go 1.21 or higher
- Git
- Basic understanding of Go and git workflows
-
Fork and clone the repository
git clone https://github.com/andev0x/gitmit.git cd gitmit -
Install dependencies
go mod download
-
Build the project
go build -o gitmit
-
Run tests
go test ./... -
Test the CLI locally
./gitmit --help
gitmit/
├── cmd/ # CLI commands and application entry
│ └── root.go # Root command and main application logic
├── internal/ # Internal packages (not importable by external projects)
│ ├── analyzer/ # Git repository analysis
│ │ └── git.go # Git operations and change analysis
│ ├── generator/ # Commit message generation
│ │ └── message.go # Message generation logic
│ └── prompt/ # User interaction
│ └── interactive.go # Interactive prompts
├── main.go # Application entry point
├── go.mod # Go module definition
├── go.sum # Go module checksums
├── README.md # Project documentation
└── CONTRIBUTING.md # This file
- Follow standard Go conventions and formatting (
gofmt,golint) - Use meaningful variable and function names
- Add comments for exported functions and complex logic
- Keep functions focused and single-purpose
- Use early returns to reduce nesting
Since this is a tool for commit messages, we should practice what we preach! Use conventional commit format:
type(scope): description
Examples:
feat(analyzer): add support for Python file detection
fix(prompt): handle EOF gracefully in interactive mode
docs: update installation instructions
test(generator): add unit tests for scope detection
refactor(cmd): simplify command structure
- Write unit tests for new functionality
- Ensure existing tests pass before submitting PR
- Test edge cases and error conditions
- Use table-driven tests where appropriate
Example test structure:
func TestGenerateMessage(t *testing.T) {
tests := []struct {
name string
analysis *analyzer.ChangeAnalysis
expected string
}{
{
name: "simple feature addition",
analysis: &analyzer.ChangeAnalysis{
Added: []string{"src/feature.go"},
// ... other fields
},
expected: "feat: add feature.go",
},
// ... more test cases
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
generator := New()
result := generator.GenerateMessage(tt.analysis)
if result != tt.expected {
t.Errorf("expected %q, got %q", tt.expected, result)
}
})
}
}When reporting bugs, please include:
-
Environment information:
- Operating system and version
- Go version (
go version) - Gitmit version (
gitmit --version)
-
Steps to reproduce:
- Clear, step-by-step instructions
- Sample repository state if possible
- Expected vs actual behavior
-
Additional context:
- Error messages or logs
- Screenshots if relevant
- Any workarounds you've found
For new features, please:
- Check existing issues to avoid duplicates
- Describe the use case and problem you're solving
- Propose a solution if you have ideas
- Consider backwards compatibility and project goals
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Follow the coding guidelines
- Add tests for new functionality
- Update documentation if needed
-
Test your changes
go test ./... go build -o gitmit ./gitmit --help # Test basic functionality
-
Commit your changes
git add . gitmit # Use gitmit to create your commit message!
-
Push and create PR
git push origin feature/your-feature-name
-
PR Requirements:
- Clear title and description
- Reference related issues
- Include test coverage
- Ensure CI passes
- Test individual functions and methods
- Mock external dependencies (git commands)
- Use table-driven tests for multiple scenarios
- Test complete workflows
- Use temporary git repositories
- Verify actual git operations
Before submitting, manually test:
- Basic functionality (
gitmitin a real repository) - Edge cases (empty repository, no staged changes)
- Different file types and change patterns
- Interactive prompts and user input
When contributing:
- Update README.md for user-facing changes
- Add inline code comments for complex logic
- Update help text and command descriptions
- Consider adding examples for new features
Releases are managed by maintainers:
- Version bumping follows semantic versioning
- Release notes highlight new features and breaking changes
- Binaries are built for multiple platforms
- Go module is tagged appropriately
- Be respectful and inclusive
- Focus on constructive feedback
- Help newcomers and answer questions
- Maintain a professional tone in all interactions
- Issues: For bugs and feature requests
- Discussions: For questions and general discussion
- Email: For security issues or private concerns
Contributors will be:
- Listed in release notes for significant contributions
- Mentioned in the README contributors section
- Invited to help with project direction and decisions
Thank you for contributing to Gitmit! Every contribution, no matter how small, helps make the tool better for everyone.