Skip to content

Git Workflow Guide

This guide outlines best practices for managing and documenting changes in your Git repositories, especially when using Penify-CLI for enhanced documentation.

1. Branching Strategy

Main Branches

  • main: The primary branch containing production-ready code.
  • develop: Integration branch for features in progress.

Supporting Branches

  • Feature branches: feature/feature-name
  • Hotfix branches: hotfix/issue-description
  • Release branches: release/version-number

2. Commit Best Practices

  1. Commit Often: Make small, focused commits rather than large, multi-purpose ones.
  2. Write Clear Commit Messages: Use Penify-CLI's commit summary generation for consistency.
    bash
    penify-cli commit -gf /path/to/repo -t your_token
  3. Use Conventional Commit Messages: Follow a format like:
    <type>(<scope>): <subject>
    
    <body>
    
    <footer>
    Example: feat(auth): add login functionality

3. Code Review Process

  1. Create a Pull Request (PR) for your feature branch.
  2. Use Penify-CLI to generate documentation for changed files:
    bash
    penify-cli doc-gen -t your_token -gf /path/to/repo
  3. Include generated documentation in your PR description.
  4. Assign reviewers and address their comments.
  5. Merge only after approval and successful CI/CD checks.

4. Documenting Changes

  1. Update CHANGELOG.md: For each release, summarize changes using Penify-CLI's output.
  2. Keep README.md Current: Update project overview and setup instructions as needed.
  3. In-Code Documentation: Use Penify-CLI to generate and update docstrings:
    bash
    penify-cli doc-gen -t your_token -fl /path/to/file.py

5. Release Process

  1. Create a release branch from develop.
  2. Use Penify-CLI to generate full repository documentation:
    bash
    penify-cli doc-gen -t your_token -cf /path/to/repo
  3. Update version numbers and CHANGELOG.md.
  4. Merge release branch to main and tag the release.
  5. Merge back into develop.

6. Continuous Integration

  1. Set up CI/CD pipelines to run tests on all PRs.
  2. Include Penify-CLI in your CI process to ensure documentation is always up-to-date.
  3. Automate the deployment process for successful merges to main.

7. Handling Hotfixes

  1. Create a hotfix branch from main.
  2. Fix the issue and use Penify-CLI to document the changes.
  3. Merge back to both main and develop.
  4. Tag the new main version.

8. Best Practices for Collaboration

  1. Keep branches up-to-date with their base branches.
  2. Resolve conflicts promptly.
  3. Use clear, descriptive names for branches and PRs.
  4. Regularly clean up merged and stale branches.

By following this workflow and leveraging Penify-CLI, you can maintain a clean, well-documented, and efficient Git repository. Remember, the key to a successful Git workflow is consistency and clear communication among team members.