rust git-logo

crates.io Main branch checks license

๐Ÿงฐ git-kit

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

text - โš ๏ธ break Breaking change that could break a consuming application - ๐Ÿ› bug Fix that resolves an unintended issue - ๐Ÿ“ฆ deps Dependency update or migration to a new dependency - ๐Ÿ“– docs Documentation change - โœจ feature Adds new functionality - ๐Ÿงน refactor Improvement of code / structure without adding new functionality - ๐Ÿงช test Adds or improves the existing tests related to the code base

๐Ÿฅฝ Prerequisites

โณ Install Binary

bash cargo install git-kit

bash git-kit --help

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

โ˜‘ Templates command

Lists currently available commit templates to add your own checkout Custom Commit templates.

```bash git-kit templates

๐Ÿ– Checkout command

Creates or checks out an existing git branch and adds a ticket number as context against that branch for future commits.

So now you don't have to remember the ticket number associated to the branch! ๐Ÿ’ก.

When it's time to commit your changes the provided ticket number will be injected into each commit message
thats created on the linked branch for you automatically! ๐Ÿ˜„

bash git-kit checkout my-branch -t TICKET-123

This will create or checkout a branch named my-branch & link TICKET-123 as the ticket number context to inject on any future commits on the branch named my-branch.

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

bash git-kit checkout TICKET-123

This will create or checkout a branch TICKET-123 & link TICKET-123 as the ticket number context to inject on any future commits on the branch TICKET-123.

๐Ÿ—’ Context command

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

This is handy if you forgot to checkout by the provided git-kit checkout command or if you've made a typo in on the provided ticket number.

Again when it's time to commit your changes the provided ticket number will be injected into each commit message
thats created on the linked branch for you automatically!

bash git-kit context TICKET-123

๐Ÿ’ Commit command

Commits your changes with a formatted message with your ticket number injected if provided from the checkout or the context command.

When committing you can specify a template to use to help describe the changes made within your commit.

text - โš ๏ธ break Breaking change that could break a consuming application - ๐Ÿ› bug Fix that resolves an unintended issue - ๐Ÿ“ฆ deps Dependency update or migration to a new dependency - ๐Ÿ“– docs Documentation change - โœจ feature Adds new functionality - ๐Ÿงน refactor Improvement of code / structure without adding new functionality - ๐Ÿงช test Adds or improves the existing tests related to the code base

bash git-kit commit bug -m "fix"

This will create an editable commit with the following format and will insert branch name will be injected by default into the bug commit template.

[TICKET-123] ๐Ÿ› fix

โš™๏ธ Configuration

You can provide your own templates simply by creating your own configuration file .git-kit.yml within your git repositories root directory.

By default the global configuration templates will be used as shown here if no configuration file is present.

๐Ÿ›  Custom Commit template example

Here's an example of a custom template called 'custom'

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

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

```bash git-kit templates

Then when your ready use it! ๐Ÿช‚

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

[TICKET-123] ๐Ÿค˜ Dang!

๐ŸŒ Global configuration

At the moment the global config is technically can be overridden but I wouldn't recommend it as global config files will be replaced on update to pull any newly added templates.

In the near future we will add a way to configure your own config location to circumvent this issue.