Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carhartl/git-commit-template
Command-line utility for managing a Git commit message template within the current project.
https://github.com/carhartl/git-commit-template
cli git go
Last synced: 28 days ago
JSON representation
Command-line utility for managing a Git commit message template within the current project.
- Host: GitHub
- URL: https://github.com/carhartl/git-commit-template
- Owner: carhartl
- License: mit
- Created: 2023-05-31T08:19:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-18T04:14:26.000Z (4 months ago)
- Last Synced: 2024-10-19T07:04:06.903Z (4 months ago)
- Topics: cli, git, go
- Language: Go
- Homepage:
- Size: 135 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# git-commit-template
[](https://github.com/carhartl/git-commit-template/actions/workflows/ci.yml)
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](https://golang.org/):
```bash
go install github.com/carhartl/git-commit-template/cmd/git-commit-template
```Via [Homebrew](https://brew.sh/):
```bash
brew install carhartl/tap/git-commit-template
```## Usage
Pass issue ref numbers with or without prefix:
```bash
git-commit-template set --issue 123 --dry-run
git-commit-template set --issue #123 --dry-run
```Produces:
```
SubjectAddresses: #123
```Pass co-author with fuzzy matching entries in author file:
```bash
echo 'John Doe ' >> $HOME/.git-commit-template-authors
echo 'Mary Tester ' >> $HOME/.git-commit-template-authors
git-commit-template set --pair doe --dry-run
```Produces:
```
SubjectCo-authored-by: John Doe
```Multiple co-authors:
```bash
git-commit-template set --pair doe --pair mary --dry-run
```Produces:
```
SubjectCo-authored-by: John Doe
Co-authored-by: Mary Tester
```Tip:
Due to the executable's naming you can also call it like so:
```bash
git commit-template ...
```E.g. use with your favorite Git alias...
## Configuration
| Env var | Default |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `GIT_COMMIT_TEMPLATE_AUTHOR_FILE` | `$HOME/.git-commit-template-authors` |
| `GIT_COMMIT_TEMPLATE_ISSUE_PREFIX` | `#` |
| `GIT_COMMIT_TEMPLATE_TEMPLATE` | `Subject{{if .Issue}}\n\nAddresses: {{.Issue}}{{end}}{{if .CoAuthors}}\n{{end}}{{range .CoAuthors}}\nCo-authored-by: {{.}}{{end}}` |`GIT_COMMIT_TEMPLATE` is a Go template string.
## Releasing
```bash
op run --env-file .env -- ./release.sh 0.1.0
```## Also see
https://cbea.ms/git-commit/