Note
Commitizen-like tool for formatting commit messages using emojis written in go.
goji is an easy-to-use commit message formatting tool, inspired by Commitizen and cz-cli, that helps you create conventional commits with emojis with streamlined [git] commit process by providing a user-friendly TUI for selecting the type of change, scope, and description of your commit message..
? Select the type of change you are committing: (Use arrow keys)
β― feature β¨ Introducing new features.
fix π Fixing a bug.
docs π Documentation change.
refactor π¨ Improve structure/format of the code.
clean π₯ Remove code or files.
? What is the scope of this change? (class or file name): (press [enter] to skip)
>
- Interactive and Non-interactive CLI with sensible defaults for choosing commit types, scopes, and descriptions and signing off commits.
- Predefined commit types with corresponding emojis.
- Customizable commit types and scopes through a JSON configuration file.
- Supports Git out of the box
Homebrew (macOs/Linux)
brew install muandane/tap/goji
Linux (or WSL)
VERSION=$(curl --silent "https://api.github.com/repos/muandane/goji/releases/latest" | jq .tag_name -r)
curl -Lso goji.tar.gz https://github.com/muandane/goji/releases/download/$VERSION/goji_${VERSION}_Linux_x86_64.tar.gz
tar -xvzf goji.tar.gz
chmod +x ./goji
# optionnal
sudo mv ./goji /usr/local/bin/
Windows (winget)
winget install muandane.goji
Build locally
git clone https://github.com/muandane/goji.git && cd goji
go build -ldflags "-s -w -X goji/cmd.version=0.0.8"
mv goji /usr/local/bin
goji --version
Build with Nix
git clone https://github.com/muandane/goji.git && cd goji
nix-build -E 'with import <nixpkgs> {}; callPackage ./default.nix {}'
Simply run goji
in your terminal to start the interactive commit process:
If you don't want the interactive screen you can use the flags to construct a message:
goji --type feat --scope home --message "Add home page" --git-flag="--porcelain" --git-flag="--branch" --signoff --no-verify --add
-a, --add Automatically stage files that have been modified and deleted
--amend Change last commit
-n, --no-verify bypass pre-commit and commit-msg hooks
To check if a commit message is conventional run:
goji check
To use the check command, add the following to your pre-commit hook in your git repository:
- repo: https://github.com/muandane/goji
rev: v0.0.8
hooks:
- id: goji-check
name: goji check
description: >
Check whether the current commit message follows commiting rules. Allow empty commit messages by default, because they typically indicate to Git that the commit should be aborted.
By default goji
comes ready to run out of the box and you can initialize a config file with commands. For now customization is in the works (?)
goji init --repo # Writes the config in the git repo's root
goji init --global # Writes the config to home directory
HOW TO
You can customize the .goji.json
generated file to add or change the scopes, types and other parameters:
{
"types": [
//***
{
"emoji": "β¨",
"code": ":sparkles:",
"description": "Introducing new features.",
"name": "feat"
},
{
"emoji": "π",
"code": ":bug:",
"description": "Fixing a bug.",
"name": "fix"
}
//***
],
"scopes": ["home", "accounts", "ci"],
"noemoji": false,
"skipquestions": [],
"subjectmaxlength": 50,
"signoff": true
}
Only "Scopes"
question can be skipped since it's optional according to the Commit Spec
Option | Type | Description |
---|---|---|
types |
Array of objects | Types for the commit messages (emoji, code, description, name) |
scopes |
Array of strings | Optional scopes for the commit messages (you can auto-complete with ctrl+e) |
noemoji |
Boolean | Creates commit message with emojis in types |
subjectmaxlength |
Number | Maximum length for the description message |
signoff |
Boolean | Add a sign off to the end of the commit message |
skipquestions |
Array of strings | Skip prompting for these questions (Unimplemented) |
Apache 2.0 license Zine El Abidine Moualhi
Thanks to @Simplifi-ED & @IT Challenge in letting me work on this open source side project and to my mentor @EtienneDeneuve for the help with learning Go lang.