21 releases

0.0.22 Apr 23, 2023
0.0.21 Feb 26, 2023
0.0.19 Jan 30, 2023
0.0.13 Dec 4, 2022
0.0.7 Sep 26, 2022

#2448 in Command line utilities

Download history 2/week @ 2024-02-21 3/week @ 2024-02-28 66/week @ 2024-03-27 118/week @ 2024-04-03

184 downloads per month

MIT license

160KB
4K SLoC

crates.io Main branch tests license

๐Ÿงฐ git-kit

๐Ÿšจ IMPORTANT

This repository has been renamed to inkan and thus this repository is now deprecated.

Please head over to the inkan repository to continue ๐Ÿ™

Use this CLI to help format your git commit messages consistently with less effort via pre-provided templates! ๐Ÿคฉ

There are two default templates provided:

  1. Simple Commit Template

  2. Conventional Commit Template

You can also create your own Custom Templates by following the Custom Template Guide.

Simple Commit Template

git-kit config set default
-  โœจ feat        Adds new functionality.
-  ๐Ÿ› bug         Fix that resolves an unintended issue.
-  ๐Ÿงช test        Improves or adds existing tests related to the code base.
-  ๐Ÿงน refactor    Improvement of code/structure without adding new functionality.
- ๐Ÿ“– docs         Change or update to documentation (i.e README's, code comments, etc).
-  ๐Ÿ“ฆ deps        Version update or migration to a new dependency.
-  โš ๏ธ break        Breaking change that may break a downstream application or service.
-  ๐Ÿ“‹ chore       Regular code maintenance.
-  ๐Ÿญ ci          Changes to CI configuration files and scripts.

Example Commit format:

  • [{ticket_num}] โ“ {message}

Template Context:

  • ticket_num ticket / issue number related to the branch.
  • message commit message.

Conventional Commit Standard Templates

git-kit config set conventional
- โœจ feat        Adds new functionality.
- โ›‘ fix         Fix that resolves an unintended issue (i.e. bug).
- ๐Ÿงช test        Improves or adds existing tests related to the code base.
- ๐Ÿงน refactor    Improvement of code/structure without adding new functionality.
- ๐Ÿ“– docs        Change or update to documentation (i.e README's, code comments, etc).
- ๐Ÿ”จ build       Changes that affect the build system or external dependencies.
- ๐Ÿ“‹ chore       Regular code maintenance.
- ๐Ÿญ ci          Changes to CI configuration files and scripts.
- ๐ŸŽ perf        Improvement of code performance (i.e. speed, memory, etc).
- ๐Ÿ•บ style       Formatting updates, lint fixes, etc. (i.e. missing semi colons).

Commit format:

  • {type}({scope}): {message}

Template commit context:

  • ticket_num ticket / issuer number related to the branch.
  • message subject message.
  • scope Short description of a section of the codebase the commit relates to.

โณ Install Binary

๐Ÿฆ€ Cargo

Install the latest version via Cargo.

cargo install git-kit
๐Ÿ MacOS

Homebrew coming soon ๐Ÿคž

Install the latest version:

curl -sS https://raw.githubusercontent.com/xsv24/git-kit/main/scripts/install.sh | sh

Depending on your setup you may need to run the script with sudo.

curl -sS https://raw.githubusercontent.com/xsv24/git-kit/main/scripts/install.sh | sudo sh -s - -b /usr/local/bin
๐Ÿง Linux

Package managers coming soon ๐Ÿคž

Install the latest version:

curl -sS https://raw.githubusercontent.com/xsv24/git-kit/main/scripts/install.sh | sh
๐ŸชŸ Windows

Coming soon ๐Ÿคž


๐ŸŽ๏ธ๐Ÿ’จ Getting Started

git-kit --help
# Checkout a new branch & add optional context params.
git-kit checkout fix-parser
  --ticket TICKET-123 \
  --scope parser \
  --link "http://ticket-manager/TICKET-123"

# Select a registered config containing templates to use.
git-kit config set

# View currently available templates on chosen config.
git-kit templates

# Commit some changes.
git-kit commit bug -m "Fix up parser"
git-kit commit chore

๐ŸŽŸ๏ธ Checkout command

Creates a new branch or checks out an existing branch attaching the following optional context parameters for use in future commit templates.

  • ticket_num Issue number related to the branch.
  • link Link to to the related issue.
  • scope Short description of a section of the codebase the commit relates to.

When it's time to commit your changes any provided context params (i.e.ticket_number) will be injected into each commit message for you automatically! ๐Ÿ˜„ It does this by a simple template string injection.

Examples:

git-kit checkout my-branch --ticket TICKET-123
git-kit checkout my-branch \
  -t TICKET-123 \
  --scope parser \
  --link "http://ticket-manager/TICKET-123"

Most likely your ticket / issue will only have one branch associated to it. In this case you can use the following shorthand ๐Ÿ‘Œ

git-kit checkout TICKET-123

๐Ÿ”— Context command

Create or update context params linked to the current checked out branch.

  • ticket_num Issue number related to the branch.
  • link Link to to the related issue.
  • scope Short description of a section of the codebase the commit relates to.

This is handy if you forgot to add context via the git-kit checkout command or if you want to update the context for future commits.

When it's time to commit your changes any provided context params (i.e.ticket_number) will be injected into each commit message for you automatically! ๐Ÿ˜„ It does this by a simple template string injection.

git-kit context \
  --ticket TICKET-123 \
  --scope parser \
  --link "http://ticket-manager/TICKET-123"

๐Ÿš€ Commit command

Commits any staged changes and builds an editable commit message by injecting any context set parameters from the checkout or context commands into a chosen template (i.e. bug).

git-kit commit bug

Example template:

[{ticket_num}] ๐Ÿ› {message} โ†’ [TICKET-123] ๐Ÿ› Fix


โ˜‘ Templates command

Lists currently available commit templates. To add your own, refer to the Custom Commit Template guide.

git-kit templates

- bug | Fix that resolves an unintended issue
- ...

โš™๏ธ Configuration

The default template will be set as active initially but you can switch between the provided configurations and any added custom templates via the config set command.

git-kit config set

โ„น๏ธ It's not recommend to alter the default template files as they could be replaced / updated on new releases.

Instead, copy & paste the desired default template, save it somewhere, and add it to the CLI as shown in the persist configuration guide.

Custom templates

Creating your own templates can be done simply by creating your own configuration file .git-kit.yml.

Here's an example of a custom template called custom

version: 1
commit:
  templates:
    custom:
      description: My custom commit template ๐ŸŽธ
      content: |
        {ticket_num} ๐Ÿค˜ {message}

Your custom configuration / templates can be provided to the CLI in one of the following ways:

  • Provide a config file path via --config option.
  • Create a .git-kit.yml config file within your git repositories root directory.
  • Use a config file previously added / linked via config add subcommand as highlighted in the persist configuration guide.

Persist Configuration

Persisting / linking your own config file can be done by providing the file path to your config file and a reference name.

git-kit config add $CONFIG_NAME $CONFIG_PATH

You can add multiple config files and switch between them via set command.

git-kit config set $CONFIG_NAME

or

# Select prompt for available configurations
git-kit config set 

> ? Configuration:  
  โžœ default
    conventional
    custom

To ensure your template has been loaded simply run the command below ๐Ÿ‘‡ to see a list of the currently configured templates.

git-kit templates

- custom | My custom commit template ๐ŸŽธ
- ...

Then when your ready to commit your changes use your custom template and your done! ๐Ÿช‚

git-kit commit custom \
 --ticket TICKET-123 \
 --message "Dang!"

[TICKET-123] ๐Ÿค˜ Dang!

Dependencies

~30โ€“42MB
~661K SLoC