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)
- Host: GitHub
- URL: https://github.com/burgr033/autocommit
- Owner: burgr033
- Created: 2025-03-03T16:13:23.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-06-11T09:08:20.000Z (7 months ago)
- Last Synced: 2025-09-11T10:46:24.540Z (4 months ago)
- Topics: commit-message, git, golang
- Language: Go
- Homepage:
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
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
```