Skip to content

danielcondemarin/monorepo-conventional-commits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Background

  • Do you use conventional commits in your daily workflow?
  • Do you specify the scope(s) every time for the packages you're working on?

If so this project might save you some time. It provides you with a git prepare-commit-msg hook that figures out the automatable parts of the commit for you.

Installation

Download the prebuilt binary from the releases page

Then simply add the prepare-commit-msg binary to the repo git hooks and give it execute permissions.

  $ cp ~/Downloads/prepare-commit-msg /your_monorepo/.git/hooks
  $ chmod +x /your_monorepo/.git/hooks/prepare-commit-msg

Currently only macos is available from the releases page. For other platforms you could build from source using rust cargo.

Usage

  • Running git commit will automatically run prepare-commit-msg for you. The commit editor should look like this:
chore(app1):

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
...

The first line of the commit message will be pre-populated for you. You could at this point change the commit type and finish the rest of the commit message.

  • You could also do git commit -m "docs: my commit message".

In this case git doesn't invoke the editor, but the precommit hook will add for you the scope if there is one, so the resulting commit could be something like: docs(app1): my commit message

Any of the conventional commits types should work.

Other commit sources such as merge, squash and commit are ignored.

Supported monorepos

Roadmap

Other resources