An open API service indexing awesome lists of open source software.

https://github.com/burgr033/autocommit

automatically get a semi-useful commit message (without AI bullshit)
https://github.com/burgr033/autocommit

commit-message git golang

Last synced: 4 months ago
JSON representation

automatically get a semi-useful commit message (without AI bullshit)

Awesome Lists containing this project

README

          

# autoCommit

Application designed as a `prepare-commit-msg` git hook that analyzes your staged files and generates a commit message **without AI bullshit**!

## Installation

```bash
go install github.com/burgr033/autoCommit@latest
```

## Configuration

create a `prepare-commit-msg` file in your git repository under `.git/hooks/` directory and put in the following (as an example):

```
#!/bin/bash

COMMIT_MSG_FILE=$1
COMMIT_SOURCE=$2

CUSTOM_HEADER="# This is an autogenerated commit message"
CUSTOM_FOOTER="# powered by github.com/burgr033/autoCommit"

# Only proceed if no commit message was explicitly provided (-m or -F options)
if [[ -z "$COMMIT_SOURCE" ]]; then
autoCommit $COMMIT_MSG_FILE $CUSTOM_HEADER $CUSTOM_FOOTER
fi
```
> [!NOTE]
> this could also be done in a git template. See https://git-scm.com/docs/git-init#_template_directory

## Features

- Pattern matching for file names for special files like `.gitlab-ci.yml` or `docs/*`
- Descriptive comments, depending on git operation
- if pattern matching for files does not bring up a result the branch name is checked for a possible "git flow" naming.

## Examples

The repo with the following `git status` on a branch called `feature/loremipsum`:

```bash
A .gitlab-ci.yml
A README.MD
MM internal/filetypes/filetypes.go
MM main.go
?? COMMIT_EDITMSG
?? test.txt
```

generates the following commit message:

```bash
# This is an automated commit message

# docs: added README.MD
# unknown: modified internal/filetypes/filetypes.go, main.go
# ci: added .gitlab-ci.yml

# This is the Footer of the automated commit message
```