Skip to content

Latest commit

 

History

History
98 lines (73 loc) · 2.47 KB

README.md

File metadata and controls

98 lines (73 loc) · 2.47 KB

git-hooks-wrapper

Make usage of git hooks easy in project of any programming language and any platform. Works on Windows with git bash.

Installation

Language Install Command Execution
Node npm install git-hooks-wrapper npx git-hooks-wrapper
Python TBD pypi pip
PHP TBD Composer PEAR Packagist
...

Basic Usage

After install automatically runs init wrapping $PWD/git-hooks folder by default. Folder can be changed by running pattern

$ $ghw init $hooksDirecotory

This project uses itself so use ./git-hooks as examples

In addition to init and hooks there are several useful scripts in ./utils that can be run with pattern

$ $ghw $command $@

Wrappers Functionality

pre-commit

Removes untracked files and recovers them afterwards - ensures that test are running without side-effects. If files was changed (untracked appeared) exists with error.

Commands list

$ $ghw
# SCRIPTS:
- init
- test
# HOOKS:
- applypatch-msg
- commit-msg
- fsmonitor-watchman
- p4-pre-submit
- post-applypatch
- post-checkout
- post-commit
- post-index-change
- post-merge
- post-receive
- post-rewrite
- post-update
- pre-applypatch
- pre-auto-gc
- pre-commit
- pre-merge-commit
- prepare-commit-msg
- pre-push
- pre-rebase
- pre-receive
- push-to-checkout
- sendemail-validate
- update
# UTILS:
- forceupdate
- forceupdate_submodules
- getbranch
- getRefsBranch
- getRemote
- semver_inc
- stash_untracked
- stats

TBD

prepare-commit-msg

Add argument with stats overview

commit-msg

Add arguments with message uniqueness and open issue existence

Further reading

About hooks

https://git-scm.com/docs/githooks

https://www.atlassian.com/git/tutorials/git-hooks

pre-commit

https://codeinthehole.com/tips/tips-for-using-a-git-pre-commit-hook/