Gitmoji helper written with â¤ī¸ in Go. Inspired by gitmoji-cli.
Install using Homebrew:
brew install jamesdobson/gogitmoji/gogitmoji
gitmoji help
gogitmoji helps you write git commit messages containing gitmoji!
Usage:
gitmoji [flags]
gitmoji [command]
Available Commands:
commit âĄī¸ Compose a commit message and execute git commit (default command)
export đĸ Export a commit template
help đ Help about any command
info đ Open gimoji information page in gyour browser
list đ List all available gitmoji
update đ Update the list of gitmoji
version âšī¸ Display the version of this program
Flags:
--config string config file (default is $HOME/.gitmoji/config.yaml)
-h, --help help for gitmoji
Use "gitmoji [command] --help" for more information about a command.
Guides the user through the process of composing a commit message, and then
executes git commit
.
gitmoji commit
commit
is the default command, so just the following is equivalent:
gitmoji
You can configure git to run gogitmoji automatically when you execute git commit
,
so that you don't always have to remember to type gitmoji
. To do so, just
set up a git hook in your git repositories:
#!/bin/sh
exec < /dev/tty
gitmoji hook do $1
exit $?
Place the above in the file <my repo>/.git/hooks/prepare-commit-msg
and ensure
the file is executable (e.g. chmod a+x prepare-commit-msg
)
Prints the list of gitmoji.
gitmoji list
đ¨ - :art: Improving structure / format of the code.
âĄī¸ - :zap: Improving performance.
đĨ - :fire: Removing code or files.
đ - :bug: Fixing a bug.
đ - :ambulance: Critical hotfix.
⨠- :sparkles: Introducing new features.
đ - :pencil: Writing docs.
đ - :rocket: Deploying stuff.
đ - :lipstick: Adding or updating the UI and style files.
đ - :tada: Begining a project.
â
- :white_check_mark: Adding or updating tests.
đ - :lock: Fixing security issues.
đ - :bookmark: Releasing / Version tags.
đ¨ - :rotating_light: Removing linter warnings.
đ§ - :construction: Work in progress.
đ - :green_heart: Fixing CI Build.
âŦī¸ - :arrow_down: Downgrading dependencies.
âŦī¸ - :arrow_up: Upgrading dependencies.
đ - :pushpin: Pinning dependencies to specific versions.
đˇ - :construction_worker: Adding or updating CI build system.
đ - :chart_with_upwards_trend: Adding or updating analytics or tracking code.
âģī¸ - :recycle: Refactoring code.
â - :heavy_plus_sign: Adding a dependency.
â - :heavy_minus_sign: Removing a dependency.
đ§ - :wrench: Adding or updating configuration files.
đ¨ - :hammer: Adding or updating build scripts.
đ - :globe_with_meridians: Internationalization and localization.
âī¸ - :pencil2: Fixing typos.
đŠ - :poop: Writing bad code that needs to be improved.
âĒ - :rewind: Reverting changes.
đ - :twisted_rightwards_arrows: Merging branches.
đĻ - :package: Adding or updating compiled files or packages.
đŊ - :alien: Updating code due to external API changes.
đ - :truck: Moving or renaming files.
đ - :page_facing_up: Adding or updating license.
đĨ - :boom: Introducing breaking changes.
đą - :bento: Adding or updating assets.
âŋī¸ - :wheelchair: Improving accessibility.
đĄ - :bulb: Adding or updating comments in source code.
đģ - :beers: Writing code drunkenly.
đŦ - :speech_balloon: Adding or updating text and literals.
đ - :card_file_box: Performing database related changes.
đ - :loud_sound: Adding or updating logs.
đ - :mute: Removing logs.
đĨ - :busts_in_silhouette: Adding or updating contributor(s).
đ¸ - :children_crossing: Improving user experience / usability.
đ - :building_construction: Making architectural changes.
đą - :iphone: Working on responsive design.
𤥠- :clown_face: Mocking things.
đĨ - :egg: Adding or updating an easter egg.
đ - :see_no_evil: Adding or updating a .gitignore file
đ¸ - :camera_flash: Adding or updating snapshots
â - :alembic: Experimenting new things
đ - :mag: Improving SEO
đˇī¸ - :label: Adding or updating types (Flow, TypeScript)
đą - :seedling: Adding or updating seed files
đŠ - :triangular_flag_on_post: Adding, updating, or removing feature flags
đĨ
- :goal_net: Catching errors
đĢ - :dizzy: Adding or updating animations and transitions
đ - :wastebasket: Deprecating code that needs to be cleaned up.
Checks to see if there is a new list of gitmoji online, updating the local cache if there are new gitmoji.
gitmoji update
The configuration file is stored at ~/.gitmoji/config.yaml
. The config file
can specify the following:
Specify the name of the default commit template:
template: "conventional"
Enable / disable prompting for commit scope:
scope: True
Note: this is used by the default gitmoji
template, but has no effect on the
default conventional
template. This can be changed by defining a custom
template and using the enablesetting
field on the corresponding Prompt
.
The emoji format can be set to either emoji
(its default value) or code
:
format: code
When set to emoji
, the UTF-8 bytes encoding the emoji will be used in the
commit message. When set to code
, an text string (e.g. :sparkles:
) will be
used. GitHub will render this as an emoji.
The configuration file allows the definition of new commit templates. A commit template has three parts:
The following example demonstrates all three elements:
templates:
example:
Command: echo
CommandArgs:
- Hello, {{ .name }}, I'm pleased to meet you.
Prompts:
- prompttype: text
mandatory: true
prompt: Enter your name
valuecode: name
This example prompts the user to enter their name, and then echoes it back to them as a polite greeting:
jamesdobson@MacBook-Pro gitmoji % gitmoji commit -t example
Using config file: /Users/jamesdobson/.gitmoji/config.yaml
â Enter your name: James
Going to execute: echo "Hello, James, I'm pleased to meet you."
Execute: y
Executing...
Hello, James, I'm pleased to meet you.
gogitmoji done.
In this example, the command is echo
. In most cases, however, Command
should
be set to git
.
The arguments to the command are expressed as an array under the CommandArgs
section. Each argument is a Go template
that can refer to inputs that come from the user prompts. If an argument evaluates
to the empty string, it is skipped.
The final section, Prompts
, is an array of user prompts. There are 3 kinds of
user prompt, differentiated by their Type
field:
text
: Prompts the user with the text in Prompt
, and waits for the user to enter a text response.choice
: Prompts the user with a selection of options as given by the Choices
field.gitmoji
: Prompts the user with a list of gitmoji.The result of the prompt is stored under the name given by the Name
field and
is made available in the command arguments via the {{ .xyz }}
syntax, where
xyz
is whatever was specified in the Name
field.
There is an additional section, Messages
, that is used when gogitmoji is called
as a commit hook. In this case, no command is executed (because commit is already
running) however the Messages
are evaluated and written to the file that git
provides to the commit hook as an argument.
This is the default gitmoji
commit template:
templates:
gitmoji:
Command: git
CommandArgs:
- commit
- -m
- '{{if eq (getString "format") "emoji"}}{{.gitmoji.Emoji}} {{else}}{{.gitmoji.Code}}{{end}}
{{with .scope}}({{.}}): {{end}}{{.title}}'
- '{{with .message}}-m{{end}}'
- '{{.message}}'
Messages:
- '{{if eq (getString "format") "emoji"}}{{.gitmoji.Emoji}} {{else}}{{.gitmoji.Code}}{{end}}
{{with .scope}}({{.}}): {{end}}{{.title}}'
- '{{.message}}'
Prompts:
- Type: gitmoji
Mandatory: true
Name: gitmoji
- Type: text
Prompt: Enter the scope of current changes
Name: Scope
Condition: scope
- Type: text
Mandatory: true
Prompt: Enter the commit title
Name: title
- Type: text
Prompt: Enter the (optional) commit message
Name: message
This is the default conventional
commit template:
templates:
conventional:
Command: git
CommandArgs:
- commit
- -m
- '{{.type}}: {{.description}}'
- '{{with .body}}-m{{end}}'
- '{{.body}}'
- '{{with .footer}}-m{{end}}'
- '{{.footer}}'
Messages:
- '{{.type}}: {{.description}}'
- '{{.body}}'
- '{{.footer}}'
Prompts:
- Type: choice
Mandatory: true
Prompt: 'Choose the type of commit:'
Name: type
Choices:
- Value: feat
Description: A new feature.
- Value: fix
Description: A bug fix.
- Value: docs
Description: Documentation only changes.
- Value: perf
Description: A code change that improves performance.
- Value: refactor
Description: A code change that neither fixes a bug nor adds a feature.
- Value: test
Description: Adding missing or correcting existing tests.
- Value: chore
Description: Changes to the build process or auxiliary tools and libraries
such as documentation generation.
- Type: text
Mandatory: true
Prompt: Enter the commit description, with JIRA number at end
Name: description
- Type: text
Prompt: Enter the (optional) commit body
Name: body
- Type: text
Prompt: Enter the (optional) commit footer
Name: footer
Licensed under the MIT license.
The gitmoji database is from Gitmoji.