Skip to content

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

Notifications You must be signed in to change notification settings

burgr033/autoCommit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

autoCommit

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

Installation

  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:

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

generates the following commit message:

# 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

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages