Skip to content

[codex] Add helper to generate commit messages from git diffs (generic + dotfiles variant) #42

Description

@0xdevalias

Overview

Introduce a shell alias/function/helper that can take git diff output, feed it into Codex with a suitable prompt, and return a well-structured commit message.

The tool should be written generically so it can work in any Git repo, and then extended with a dotfiles-specific wrapper that defaults to ~/.dotfiles.

Example

Generic usage:

⇒ git -C /path/to/repo diff repoPath/to/file | codex "Generate a concise commit message for this diff"

Dotfiles-specific wrapper:

⇒ git -C ~/.dotfiles/bin diff dotfiles-create-bin | codex "Generate a concise commit message for this dotfiles change"

Goals

  • Provide a smooth workflow for drafting commit messages without copy/pasting diffs.
  • Ensure generated commit messages are consistent, scoped, and conventional.
  • Make the generic helper reusable across repos.
  • Provide a dotfiles-scoped alias/function that builds on the generic helper.

Proposed Approach

  • Implement a generic helper script/alias (e.g., codex-git-commit-msg):

    • Runs git diff (or accepts an existing diff via pipe).
    • Pipes the diff into Codex with a commit-message prompt.
    • Outputs the proposed commit message.
  • Add a dotfiles wrapper (e.g., codex-dotfiles-commit-msg) that:

    • Uses git -C ~/.dotfiles automatically.
    • Provides a dotfiles-specific prompt context.

References

  • Codex CLI docs: codex -h

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions