Some hooks for pre-commit.
Add this to you .pre-commit-config.yaml
- repo: https://github.com/tenfyzhong/pre-commit-hooks
rev: 0.1.0 # Use the ref you want to point at
hooks:
- id: forbid-swap-file
# - id: ...
Prevent swap files from being committed.
A swap file is a editor's backup file, the file name of it would likes .foo.swp
Check the user name and email match the remote or not before commit to index. You should set environment below first:
GIT_WORK_REMOTE
the special remote to matchGIT_WORK_NAME
the user name for the work remoteGIT_WORK_EMAIL
the user email for the work remoteGIT_PERSONAL_NAME
the default name not match the work remoteGIT_PERSONAL_EMAIL
the default email not match the work remote
Prevent binary files from being commited
This is a hook for stage post-commit. It will dump the commit message to sqlite3 file which locate in ~/.local/state/commit-msg-log/[year].sqlite3
You can analyse your job by these db files.