Skip to content

carhartl/git-commit-template

Repository files navigation

git-commit-template

CI

Command-line utility for managing a Git commit message template within the current project.

  • Optional issue reference
  • Optional Co-authored-by line

Installation

With Go:

go install github.com/carhartl/git-commit-template/cmd/git-commit-template

Via Homebrew:

brew install carhartl/tap/git-commit-template

Usage

Pass issue ref numbers with or without prefix:

git-commit-template set --issue 123 --dry-run
git-commit-template set --issue #123 --dry-run

Produces:

Subject (keep under 50 characters)

Context/description (what and why)

Addresses: #123

Pass co-author with fuzzy matching entries in author file:

echo 'John Doe <[email protected]>' >> $HOME/.git-commit-template-authors
echo 'Mary Tester <[email protected]>' >> $HOME/.git-commit-template-authors
git-commit-template set --pair doe --dry-run

Produces:

Subject (keep under 50 characters)

Context/description (what and why)

Co-authored-by: John Doe <[email protected]>

Multiple co-authors:

git-commit-template set --pair doe --pair mary --dry-run

Produces:

Subject (keep under 50 characters)

Context/description (what and why)

Co-authored-by: John Doe <[email protected]>
Co-authored-by: Mary Tester <[email protected]>

Tip:

Due to the executable's naming you can also call it like so:

git commit-template ...

E.g. use with your favorite Git alias...

Configuration

Env var Default
GIT_COMMIT_TEMPLATE_ISSUE_PREFIX #
GIT_COMMIT_TEMPLATE_AUTHOR_FILE $HOME/.git-commit-template-authors

Releasing

op run --env-file .env -- ./release.sh 0.1.0

Also see

https://cbea.ms/git-commit/

About

Command-line utility for managing a Git commit message template within the current project.

Topics

Resources

License

Stars

Watchers

Forks