Git history can be your source of truth. Same as with your code you need to take care of it. Codebase linting is common practice, but why neglect git history? How often you try to debug Error and git blame is not helpful because of the low-quality git message.
You can run gitector as part of your pre-commit check or CI pipeline.
You can configure gitector in any way some of the possible features include:
- Allow only commits with Ticket number
- Allow contributions restricted to corporate e-mail
- Disallow merges
- Define maximum characters for the title
- Encourage small commits by limiting the number of files in a single commit
- Make sure commit starts with action verb describing changes (like add, remove, fix)
- Init configuration inside your repo using
gitector init
- Edit .gitector.json to fit your
- Run
gitector
to check your branch against defined rules
Init gitector configuration with default settings
gitector init
Run gitector against your local branch and master branch
Gitector ..master
Get more support
gitector —-help
Edit file .git/COMMIT_EDITMSG
and put inside
gitector -di
You can find latest version to add to your workflow here
Add code below to your .gitlab-ci.yml
file
gitector:
stage: build
image: gitector/gitector
script:
- git fetch
- gitector
except:
- master