mkcommit
mkcommit is an extremely simple tool made for commit message generation.
Run mkcommit instead of git commit and you will be asked questions that keep your commits tidy even when it's 3 AM.
Why?
Why would anybody need this? Aren't editors enough?
When working in teams it's hard to enforce proper Git commit message style from everyone. This CLI tool asks you questions to build a commit message that you can configure for yourself and your team with a very simple Python script.
commitlint exists. Why mkcommit?
commitlint is a great tool. But it has considerable learning curve if you want to leverage its full potential. This tool strives to be the exact opposite: provide bare minimum with almost no overhead for your teammates. All they will need to learn is this one command: mkcommit.
mkcommit is:
- Easy to install - all you need is Python (at least version 3.6).
- Easy to configure - all you need is basic Python skills or advanced copy-pasting skills.
- Easy to use - all you need is one command to trigger the commit prompt.
- Scalable - it can be as complex as you want it, with full Git Hook integration and complex validation rules or just with a plain default Conventional Commit generation out-of-the-box.
- Pythonic - might suit you better if you're familiar with Python and don't want to venture into the world of JavaScript.
Installation
If you have Python set up, you're good to go. Run pip install mkcommit and you're done.
Configuration
-
At the root of your repository create a Python file named
.mkcommit.py. -
Compose the script:
-
A built-in conventional commit suite can be used:
from mkcommit import CommitMessage, to_stdout from mkcommit.suites import conventional def commit(): return CommitMessage(*conventional.default()) if __name__ == "__main__": to_stdout(commit())
If you're not familiar with Conventional Commits, here's a quick guide.
-
If you need to define your own keywords and commit message template, read Configuration in our Wiki.
- If you want to learn how to use the hook mode, read Hooks in our Wiki.
-
When you have implemented the file in one repo and want to use the exact same file in another repo, you should use
includee.g.from mkcommit import to_stdout, include commit, on_commit = include("https://raw.githubusercontent.com/kjczarne/mkcommit/master/test/res/example.semantic.mkcommit.py") if __name__ == "__main__": to_stdout(commit())
-
-
Run
mkcommit. Select the discovered configuration file for the list and follow the interactive prompt.
Usage
- Run
mkcommitto generate a Git commit message and commit changes (callsgit commit -munderneath). - Run
mkcommit -sto generate a Git commit message and print it to standard output. - Run
mkcommit -cto generate a Git commmit message and copy it to your clipboard. - Use
mkcommit -x "some commit message"to validate an existing commit message from the command line or as a Git Hook command (requireson_commit(msg)function to be implemented in the configuration file).
If you wish to point mkcommit to a specific configuration file, use mkcommit -f /path/to/.mkcommit.py. You can combine the -f flag with all the other available flags.
Of course you may use mkcommit with VSCode tasks.
Input validation
The most basic validation strategy we use is validation at the time of message generation.
For validation of commit messages that aren't originally generated with mkcommit you can use Hooks.
Built-in suites
A list of suites that are supported out-of-the-box can be found in our Wiki.
Metadata
Release files for mkcommit 1.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mkcommit-1.3.2-py3-none-any.whl | Python 3 | none | any | Details for mkcommit-1.3.2-py3-none-any.whl |
Release files / mkcommit-1.3.2-py3-none-any.whl
| Download URL | mkcommit-1.3.2-py3-none-any.whl |
|---|---|
| Size | 22.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03142bf1302f19817a75e3d267b2b193bff07ff33733c7995536f0fd4c5175eb
|
|
BLAKE2b-256 checksum How to use checksums |
79c94655be189a46cd847ff9416809263d0864baa3f2a8cff0b741997170dd47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.1
|
Security for mkcommit 1.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.