[Python] How can I automatically run a command immediately after git add?

Discussão em 'Python' iniciado por Stack, Abril 20, 2025.

  1. Stack

    Stack Membro Participativo

    I'm working on a side project to make my git commit message better and make the process faster, but I cant seem to figure out how to trigger the scripts after git add, without manually doing it.

    This is the flow I want:

    1. I run git add.
    2. My script kicks in immediately. It fetches the staged diff.
    3. AI generates a commit message
    4. It asks for confirmation
    5. If confirmed, it commits.

    I've tried looking into hooks like pre-commit, but those seem to run before git commit, not git add. Ideally, I'd love to run the message generator right after I run git add, possibly via a Git alias or a custom CLI.

    Continue reading...

Compartilhe esta Página