A tool that makes it easy to produce structured commit messages, that are easily customizable to your project’s need.
[documentation] enhancement: adding to the spec
Documenting some more of the edge cases we'll have to handle
so that we make sure to get everything right.
Ticket: 12345
Tags: hotfix, refactoring
That commit message is made up of many interactive component parts. Some are optional. Some are required. The commit message above is a complex example made up of the following elements.
<code-section> <change-type> <commit-title> <commit-description> <ticket-number> <tags>
<code-section>is a modifiable select list<change-type>is a modifiable select list<commit-title>is a simple text input<commit-description>is a multi-line text input<ticket-number>is an optional input that (in this configuration) will validate that the user has entered an integer.<tags>is an optional multi-select list
Once you’ve added the git-com executable to your path, typing git com instead of the usual git commit will invoke a series of prompts based on what you configure in your .git-com.yaml file at the root of your git repository. The resulting text is combined to make a structured commit message.
There can be as many, or as few elements in your configuration as you want. The only requirement is that you have at least one element in your YAML whose input will end up in the commit title.
You can also add text around the user submitted input. In the example above the <code-section> is configured with "[" as its before-string and "]" as its after-string. I just chose documentation from the select list it showed me.
brew tap masukomi/homebrew-tap
brew install masukomi/homebrew-tap/git-com- Go 1.21 or later
- Git
git clone https://github.com/yourusername/git-com.git
cd git-com
go build -o git-com .Move the binary to a directory in your PATH:
# Linux/macOS
sudo mv git-com /usr/local/bin/
# Or add to your personal bin directory (if that's in your PATH)
mv git-com ~/bin/Because the executable is named git-com, Git will automatically recognize it as a subcommand. Once installed, you can run:
git comThis will execute the git-com tool and start presenting you with the interactive elements specified in your repo’s .git-com.yaml file.
This works because Git looks for executables named git-<command> when you type git <command>.
- Create a
.git-com.yaml(or.git-com.yml) file in the root of your Git repository See Config File Details (orconfig_file_details.orglocally) for detailed instructions. The.git-config.yamlin this repo is a fairly complex example. - Stage your changes with
git add - Run
git cominstead ofgit commit - Answer the interactive prompts
- Your commit is created with a structured message
Press Ctrl+C or Esc at any prompt to abort without creating a commit.