Thank you for your interest in contributing! This document provides guidelines for contributing to this project.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/yourusername/git-cli.git cd git-cli - Install dependencies:
cargo build
- Rust 1.70 or higher
- Git 2.0 or higher
- A terminal that supports ANSI colors
# Debug build
cargo build
# Release build
cargo build --release# Run all tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific test
cargo test test_name# Run clippy (linter)
cargo clippy -- -D warnings
# Format code
cargo fmt
# Check formatting
cargo fmt --all -- --check- Follow standard Rust conventions
- Use
rustfmtfor formatting - Run
clippyand fix all warnings - Write comprehensive tests for new features
- Add documentation for public APIs
Use this tool itself for commits! But follow these guidelines:
- Use conventional commit format:
type(scope): description - Keep the first line under 50 characters
- Use present tense ("add feature" not "added feature")
- Reference issues when applicable
Place unit tests in the same file as the code being tested:
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_function_name() {
// Test implementation
}
}Place integration tests in the tests/ directory.
We aim for high test coverage. Run coverage with:
cargo tarpaulin --out htmlWhen adding new dependencies:
- Use the minimal feature set needed
- Prefer well-maintained crates
- Update
Cargo.tomlwith appropriate version constraints - Document the reason for the dependency
When filing bug reports, please include:
- Operating system and version
- Rust version (
rustc --version) - Git version (
git --version) - Steps to reproduce
- Expected vs actual behavior
- Relevant log output (use
--debugflag)
For feature requests:
- Check existing issues first
- Describe the use case
- Explain why it would be beneficial
- Consider if it fits the project's scope
-
Create a feature branch from
main:git checkout -b feature/amazing-feature
-
Make your changes following the code style guidelines
-
Add tests for any new functionality
-
Update documentation if needed
-
Run the full test suite:
# Run all tests (unit + integration + doctests) cargo test --verbose --all-features # Run linting with all features cargo clippy --all-targets --all-features -- -D warnings # Check code formatting cargo fmt --all -- --check # Build release version cargo build --release --verbose # Test binary functionality ./target/release/git-cli --version ./target/release/git-cli --help
-
Commit your changes using this tool:
git-cli
-
Push to your fork:
git push origin feature/amazing-feature
-
Open a Pull Request with:
- Clear title and description
- Reference to related issues
- Screenshots if UI changes
- Test results
- All PRs require at least one review
- CI must pass (tests, linting, formatting)
- Maintain backwards compatibility when possible
- Update changelog for user-facing changes
- Update version in
Cargo.toml - Update
CHANGELOG.md - Create git tag:
git tag v0.x.0 - Push tag:
git push origin v0.x.0 - GitHub Actions will handle the release
Use the --debug flag to enable detailed logging:
git-cli --debugCreate test repositories with various states:
mkdir test-repo && cd test-repo
git init
echo "test" > file.txt
git add file.txt
# Test various scenariossrc/
├── main.rs # CLI entry point
├── lib.rs # Library exports
├── config/ # Configuration management
├── git/ # Git operations
├── ui/ # User interface
├── emojis.rs # Emoji definitions
├── errors.rs # Error types
├── utils.rs # Utility functions
└── validation.rs # Validation logic
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Keep discussions on topic
- Open an issue for bugs or feature requests
- Check existing issues and documentation
- Ask questions in discussions
Thank you for contributing! 🎉