git_auto_commit

package module
v0.0.0-...-9dff534 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2025 License: ISC Imports: 17 Imported by: 0

README ยถ

git-auto-commit

GoDoc Build Go Report Card License

๐Ÿšง Work in Progress

git-auto-commit is actively being developed. Expect frequent updates and improvements.

git-auto-commit โœจ is an open-source tool written in Go that leverages a large-language model (LLM) to automatically draft commit and pull request messages. This allows developers to stay focused on the why and how of software development while maintaining high-quality documentation in commit histories. By automating commit message generation, git-auto-commit helps save time, streamline development workflows, and make changes easier to review.

๐Ÿš€ Installation

To install git-auto-commit, run the following command:

curl -fsSL https://get.git-auto-commit.org | sh

๐Ÿ“– Usage

โœ๏ธ git auto-commit

git auto-commit analyzes your staged changes and generates a clear, contextual commit message using an LLM.

Options:
  • -v, --verbose (default) โ€“ Opens your $EDITOR (or falls back to nano or vi) with a suggested commit message. Edit and save to finalize the commit.
  • -y, --yes โ€“ Commits your changes with the suggested message without prompting.
  • -m MSG, --message MSG โ€“ Adds extra context to the LLM, useful for explaining why the change was made.
  • -M MODEL, --model MODEL โ€“ Overrides the default model used for message generation.
  • -p PROVIDER, --provider PROVIDER โ€“ Overrides the default LLM provider.

Additional arguments can be passed to git commit:

git auto-commit -m "My message" -- --amend
๐Ÿ”€ git auto-pr

git auto-pr automates PR descriptions using AI, reducing manual effort and ensuring well-structured messages. Requires the GitHub CLI (gh).

Usage

All options from git auto-commit apply, with the ability to pass additional arguments to gh.

git auto-pr -m "My message" -- --open

This example adds a custom message and opens the PR immediately after creation.

๐Ÿ“Œ Roadmap

git-auto-commit is under active development, and several features are planned for future releases:

  • Customization & Configuration

    • Users can configure tool behavior through git-config (#20)
    • Specify LLM model with --model/-M flag (#4)
    • Supply context manually via --message/-m option (#2)
  • Commit Message Generation

    • Automatically draft commit messages (#1)
    • Derive commit style from:
      • Built-in templates (#18)
      • User preferences (#16)
      • Past commit messages (#10)
    • Split large commits into smaller, focused commits (#13)
  • Pull Request Generation

    • Draft pull request messages from git log -p (#3)
    • Derive pull request style from:
      • Built-in templates (#19)
      • User preferences (#17)
      • Repository templates (#15)
      • Past merged pull requests (#11)
  • Enhanced Functionality

    • Stream LLM output to the terminal before opening $EDITOR (#12)
    • Offer to update the changelog if one is present (#9)
    • Users can provide context via voice (speech-to-text) (#14)
  • Packaging & Distribution

    • Publish Homebrew formula (#7)
    • Publish Debian/Ubuntu packages (#6)
    • Support easy install through curl | bash (#5)
    • Include Go/Devcontainer boilerplate (#8)

๐Ÿ›  Development

To develop locally, clone the repository and use the provided scripts:

bin/setup    # Set up the development environment
bin/build    # Build the project
bin/test     # Run the test suite

Additionally, the repository includes a Devcontainer configuration compatible with IDEs such as VS Code and Cursor, enabling a seamless development experience.

๐Ÿค Contributing

Contributions are welcome! ๐ŸŽ‰ If youโ€™d like to contribute, please check the open issues, fork the repository, and submit a pull request. Discussions, feedback, and suggestions are encouraged in the issue tracker.

๐Ÿ“œ License

This project is open-source and licensed under the ISC License.

Documentation ยถ

Index ยถ

Constants ยถ

This section is empty.

Variables ยถ

This section is empty.

Functions ยถ

func AutoCommit ยถ

func AutoCommit(ctx context.Context, config *Config) error

AutoCommit uses Git to commit staged changes, generating a commit message using AI.

func AutoPullRequest ยถ

func AutoPullRequest(ctx context.Context, cfg *Config) error

func GenerateCommitMessage ยถ

func GenerateCommitMessage(ctx context.Context, config *Config, staged string) (string, error)

GenerateCommitMessage generates a commit message for the given staged changes and Config using AI.

Types ยถ

type Config ยถ

type Config struct {
	*config.Config

	// Verbose opens an editor for the user to review messages.
	Verbose bool

	// Yes skips the editor and directly commits the message.
	Yes bool

	// Message provides additional context for the commit message. It's supplied
	// by the user on the command line.
	Message string

	// ExtraArgs are additional arguments to pass to the used git/gh command.
	ExtraArgs []string
}

Command is the configuration for the git-auto-commit and git-auto-pr commands.

Directories ยถ

Path Synopsis
cmd
git-auto-commit command
git-auto-pr command
Package config provides functionality for loading and managing user-configurable settings in a layered fashion.
Package config provides functionality for loading and managing user-configurable settings in a layered fashion.
Package template provides a simple wrapper around the text/template package for rendering templates with data.
Package template provides a simple wrapper around the text/template package for rendering templates with data.
util
git
log

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL