How I use AI, Raycast, Ollama and Git to help me write better Commit & Pull Request messages

Auteur(s) de l'article

In this blog post, I’ll explain how I’ve streamlined my Git workflow using AI to generate more effective commit messages and pull request descriptions.
My motivation was simple: create a seamless process that leverages AI with proper context about my work — understanding the task, Jira issues & file changes.
Throughout this article, I’ll showcase using Ollama with Gemma 3, which delivers excellent results while being energy-efficient.
I’m open to feedback about other Models that work well for this use case.
🚨 Environmental Disclaimer: AI models can have a significant environmental footprint. To reduce energy consumption, I strongly recommend using local models for these types of routine tasks rather than cloud-based solutions.

Why This Workflow Matters

Writing clear, informative commit messages and pull request descriptions is crucial for project maintainability, but it’s often rushed or treated as an afterthought.
By automating the generation process while maintaining human oversight, we can achieve:
  • Consistency: Every commit follows similar formatting and information standards
  • Context Preservation: Important details about changes don’t get lost
  • Time Efficiency: Less mental overhead when switching between coding and documentation
  • Better Collaboration: Team members can quickly understand what changed and why
    The key insight is that AI excels at synthesizing technical information when given proper context, but human judgment remains essential for accuracy and appropriateness.

    Ollama

    Ollama provides an excellent way to run large language models locally, giving you the power of AI without the privacy concerns or environmental impact of cloud services. It supports various models and makes local AI incredibly accessible.
    I believe AI is certainly the future of development and automation, but we must use it responsibly. Local models like those available through Ollama represent a more sustainable approach to everyday AI tasks.

    Installation 

    The installation process is straightforward across different platforms. Here’s a comprehensive video walkthrough that covers everything you need to get started:
    After installation, you can quickly verify everything works by running
    ollama run gemma3:4b
    For our Git workflow, I recommend starting with gemma3:4b or gemma3:12b depending on your system's capabilities. These models provide excellent code understanding while maintaining reasonable resource requirements.

    Raycast

    Raycast AI Commands feature transforms how we interact with AI models by allowing custom instructions with dynamic placeholders. This makes it perfect for creating reusable, context-aware Git workflows.

    Commit Message Generator

    This command analyzes staged changes and generates appropriate commit messages following conventional commit standards.
    The prompt template for Raycast:
    You are a Git commit message generator. Based on the provided git diff and branch name, write a clear, concise commit message following these guidelines:
    
    1. Write in imperative mood (e.g., "Add", "Fix", "Update", not "Added", "Fixed", "Updated")
    2. Keep the first line under 50 characters
    3. Start with lowercase letter
    4. Don't end with a period
    5. If the branch name follows the pattern "feature/JIRA-123" or similar, extract the Jira ticket and add it at the end with a dash: " - PROJ-456"
    6. Focus on what the change does, not how it does it
    7. Use single quotes instead of double quotes if quotes are needed
    
    Examples (note the Jira ticket is at the END with a DASH, not in brackets):
    - add user authentication logic - PROJ-456
    - fix null pointer exception in payment service - BUG-789
    - update documentation for API endpoints
    - remove deprecated helper functions - TASK-123
    - refactor database connection handling - DEV-890
    - implement password reset functionality - AUTH-234
    - delete unused CSS classes - UI-567
    - optimize image loading performance - PERF-123
    - create new user registration form - USER-445
    - modify email validation rules - VALID-678
    - integrate third party payment gateway - PAY-901
    - disable legacy authentication method - SEC-432
    
    Git diff: {clipboard}
    Branch name: {argument name="branch"}
    
    Steps:
    1. Analyze the git diff to understand the changes
    2. Use the branch name to extract any Jira ticket
    3. Generate commit message
    
    At the end, provide 3 commit message variants in this exact format for easy copy-paste:
    
    OPTION 1:
    [commit message here]
    
    OPTION 2:
    [commit message here]
    
    OPTION 3:
    [commit message here]
    Key features:
    • Uses {clipboard} to analyze the git diff
    • Accepts {argument name="branch"} to extract Jira tickets
    • Provides multiple commit message options
    • Follows imperative mood conventions

      Pull Request Description Generator

      This command creates comprehensive PR descriptions that help reviewers understand the context and scope of changes.
      The prompt template:
      You are a technical writer creating a pull request description. Analyze the provided git diff/log and create a clear, concise PR description that helps reviewers understand the changes and their impact.
      
      Guidelines:
      - Focus on WHAT changed and WHY it improves the project
      - Use present tense and active voice
      - Don't use double quotes in the output
      - Be specific about the impact and benefits
      - Extract Jira tickets from commit messages (format: PROJ-123, BUG-456, etc.)
      - Prioritize the most important changes first
      
      Write your output in a code block using this template:
      
      ```
      ### 💬 Description
      
      [One-sentence summary of what this PR accomplishes]
      
      [Bullet list of key changes - focus on user/developer impact, not implementation details]
      
      ### 🎟️ Issue(s)
      
      [Only include if Jira tickets found in commits - list as "- PROJ-123"]
      
      ### 🔢 To Review
      
      [Bullet list focusing on areas that need careful attention - security, performance, breaking changes, new APIs, etc.]
      ```
      
      Examples of good vs bad descriptions:
      
      GOOD:
      - "Improves user login performance by 40%"
      - "Adds email validation to prevent invalid registrations"
      - "Fixes memory leak in image processing pipeline"
      
      BAD:
      - "Updates UserController.php"
      - "Changes some methods"
      - "Refactors code"
      
      Git diff/log data: {argument name="diff"}
      
      Remember: Focus on the business value and impact, not just the technical changes.
      Key features:
      • Analyzes the diff between current branch and dev
      • Generates structured PR descriptions
      • Automatically extracts Jira tickets from commit messages

        Connecting the Pieces

        The magic happens when we connect our AI commands to our Git workflow through simple bash functions. These scripts automatically gather the necessary context and trigger the appropriate Raycast commands.
        Add these functions to your shell configuration file (.bashrc, .zshrc, etc.)

        Commit Message Script

        aimsg function in action
        unalias aimsg 1>/dev/null 2>&1
        aimsg() {
            # Copy the staged diff to clipboard for AI analysis
            git --no-pager diff --cached | pbcopy
            
            # Get the current branch name
            branch=$(git symbolic-ref --short HEAD)
            
            # Open Raycast AI command with branch context
            open -g "raycast://ai-commands/commit-message?arguments={\"branch\":\"$branch\"}"
        }
        How it works:
        1. Captures staged changes (git diff --cached)
        2. Copies diff to clipboard for AI analysis (| pbcopy|)
        3. Extracts current branch name for ticket detection (git symbolic-ref — short HEAD)
        4. Launches Raycast with the commit message AI command

          Pull Request Script

          aipr function in action.
          unalias aipr 1>/dev/null 2>&1
          aipr() {
              # Get the diff between current branch and main/dev
              diff=$(git log --oneline dev.."$(git symbolic-ref --short HEAD)")
              
              # Launch Raycast AI command with diff data
              open -g "raycast://ai-commands/pull-request-pr-description?arguments={\"diff\":\"$diff\"}"
          }
          How it works:
          1. Generates a log of commits between current branch and dev
          2. Passes this diff directly to the PR description generator
          3. Launches Raycast with the PR description AI command

            Conclusion

            This AI-enhanced Git workflow has fundamentally transformed how I approach git messages. However, it’s crucial to understand that AI is a companion, not a replacement for human judgment.
            The most valuable aspect of this workflow isn’t just the time savings — it’s how AI helps improve the quality and consistency of my technical communication. For non-native English speakers like myself, AI serves as an excellent writing companion that helps express technical concepts more clearly.
            As we integrate AI more deeply into our development workflows, we must use these tools responsibly:
            • Always review AI output before committing or submitting
            • Understand the changes you’re documenting
            • Choose sustainable options like local models when possible
            • Maintain human oversight for all AI-generated content
              AI is certainly the future of development automation, but the most successful implementations will always combine AI efficiency with human wisdom and oversight.
              ❤️ Love on your keyboards & Happy coding.

              Sources

              Yann Gouffon (2025) My awesome colleague @ Antistatique.
              https://yago.io
              Léo Duff (2025) Comment ChatGPT assoiffe cette population
              Comment ChatGPT assoiffe cette population.
              https://www.youtube.com/watch?v=LNoklk0NRmQ&t=1s
              Raycast (2025) Local Models in Raycast AI (in under 2min)
              https://www.youtube.com/watch?v=FjkAuklziGk
              Riderman de Sousa Barbosa (2025) How I use AI, Raycast, and Lazygit to help me write better commit messages.
              https://www.showwcase.com/article/83307/how-i-use-ai-raycast-and-lazygit-to-help-me-write-better-commit-messages
              Hritik Jaiswal (2021) Understand how to write a good commit message through memes.
              https://medium.com/@hritik.jaiswal/how-to-write-a-good-commit-message-9d2d533b9052

              Resources

              Claude AI https://claude.ai
              Assisted with writing and refining my English.
              xkcd https://xkcd.com
              Added comedic context to the subject matter.
              Workchronicles https://workchronicles.com
              Added a touch of humor to this article.
              All images copyright of their respective owners.