https://github.com/cassin01/rcz
A tool to write a commit message
https://github.com/cassin01/rcz
cli git rust
Last synced: 19 days ago
JSON representation
A tool to write a commit message
- Host: GitHub
- URL: https://github.com/cassin01/rcz
- Owner: Cassin01
- License: mit
- Created: 2022-09-21T13:53:23.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T04:17:16.000Z (almost 3 years ago)
- Last Synced: 2025-04-11T17:52:42.048Z (7 months ago)
- Topics: cli, git, rust
- Language: Rust
- Homepage:
- Size: 3.38 MB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rcz
A tool to write a commit message based on [Conventional Commits](https://www.conventionalcommits.org/)
inspired by [git-cz](https://github.com/streamich/git-cz)

## Installation
```sh
cargo install rcz
```
## Example
```zsh
# bash
function gitz() {
local output
if output=$(rcz); then
git commit -m "${output}"
else
echo "Err: failed to generate a commit message"
fi
}
```
or
`.gitconfig`
```.gitconfig
[alias]
cz = "!gitz() { if local output= ...}; gitz"
```
gif

## Configuration
The configuration file will be automatically generated on:
- Linux: `~/.config/rcz`
- Windows: `{FOLDERID_RoamingAppData}\rcz`
- Mac OS: `~/Library/Preferences/rs.rcz`
Default configuration
```toml
format = '''
{type}: {subject}'''
[[types]]
description = 'A bug fix'
value = 'fix'
emoji = '๐'
[[types]]
description = 'A new feature'
value = 'feat'
emoji = 'โจ'
[[types]]
description = 'Changes that introduces a breaking API change'
value = 'BREAKING CHANGE'
emoji = '๐ฅ'
[[types]]
description = 'build system or external dependencies'
value = 'chore'
emoji = '๐ ๏ธ'
[[types]]
description = 'CI related changes'
value = 'ci'
emoji = '๐ซ'
[[types]]
description = 'Documentation only changes'
value = 'docs'
emoji = 'โ๏ธ'
[[types]]
description = 'Changes that do not affect the meaning of the code'
value = 'style'
emoji = '๐'
[[types]]
description = 'A code change that neither fixes a bug nor adds a feature'
value = 'refactor'
emoji = '๐งน'
[[types]]
description = ' A code change that improves performance'
value = 'perf'
emoji = '๐'
[[types]]
description = 'Adding or correcting tests'
value = 'test'
emoji = '๐งช'
```
### Format
All section etc `{scope}` that you can add on the format are bellow.
- `{type}`
- `{emoji}`
- `{description}`
:warning: The string that enclosed in double brackets (`{{echo 'foo'}}`, `{{date}}` etc) is interpreted as shell script.
Other strings (`{body}`, `{footer}`, `{header}` etc) is interpreted as a custom input.
The string is used as a prompt message.
Sometimes you don't have a scope and have to delete the brackets. If a space is entered for scope, brackets are removed altogether. [#6](https://github.com/Cassin01/rcz/issues/6)
A example for your customize is bellow.
```toml
format = '''
{type}{scope}: {emoji}{subject}
{body}
{footer}'''
```