This is a simple command line tool inspired by this gist about semantic commit messages. In short, it proposed to use labelled commit messages that derive their format from Angular's commit rules.
The sema command will help you follow these guidelines with no effort on your
part to memorise labels or double-check things.
Each commit message is supposed to be formatted in the following way:
TYPE(SCOPE): MESSAGE
Where SCOPE tells you about the scope of changes, MESSAGE summarises those
in a concise way, and TYPE is a short label from the following:
feat: new feature for the userfix: bug fix for the userdocs: changes to the documentationstyle: formatting with no production code changerefactor: refactoring production codetest: adding missing tests, refactoring testsperf: performance improvementschore: updating grunt tasksinfra: infrastructural changes
Install Mage whichever way you like, then run the following:
git clone [email protected]:sharpvik/sema.git
cd sema
mage installThis way is recommended because my automated publishing pipelines for Homebrew and AUR may break but with
mageyou can always get the latest version no matter what and cross-platform. The builds are fast and clean.
brew install sharpvik/sema/semayay -S semaThis will not insert the latest version into the binary, so sema --version
will give you nothing, but it's simpler than the recommended mage install.
go install github.com/sharpvik/sema/v3Both
yayandgoputsemabinary into your$GOPATH/binduring installation so make sure that your$GOPATH/binis in$PATH!
NAME:
sema - Semantic commits made simple
USAGE:
sema [global options] command [command options] [arguments...]
COMMANDS:
github Open sema GitHub repository in browser
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--add, -a begin by running 'git add' (default: false)
--push, -p run 'git push' on successful commit (default: false)
--force, -f force push changes with 'git push -f' (default: false)
--long, -l open editor to elaborate commit message (default: false)
--breaking, -b mark commit as introducing breaking changes (default: false)
--tags, -t push tags along with commits (default: false)
--help, -h show help
--version, -v print the versionThe --push and --add flags can be combined (or -ap), which will be
equivalent to running the following:
git add .
git commit -m "feat(*): commit description"
git pushAdding the --force flag to --push (or -pf) runs forceful push:
git push -fThe
--forceused without--pushwill be ignored.
The --breaking flag will append an exclamation point to the end of your commit
label like so:
fix!(server): critical API changeOn top of that, using --breaking with the --long flag (or -bl),
appends BREAKING CHANGE suffix to the commit template file for your
convenience as follows:
fix!(server): critical API change
BREAKING CHANGE: [elaborate on this breaking change here]By default, git commit opens an editor in your terminal where you can write a
commit message. For shorter commits, one could use git commit -m "*****",
which is the default mode of operation for sema.
However, sometimes it is very beneficial to be able to elaborate your commit
message instead of just posting a semantic title. For this use case, meet the
new --long execution flag: after helping you come up with a semantic commit
title, it will open an editor (with your title prepended at the top) and let you
write some prose or poetry (whatever helps you get promotions).