Git hooks for better pivotal integration:
pre-commit
:- prevents commiting on a branch that is not suffixed by an issue number. Some special branches (
develop
,master
) andhotfix
es are not constrained - lints modified python files and exits upon non correctly formatted modules
- other formats (js, scss) have pending code that is not currently called as the workflow for front code is not clear
- prevents commiting on a branch that is not suffixed by an issue number. Some special branches (
prepare-commit-msg
: prepend issue number to commit message if it's missing and if it is set in the branch name (seepre-commit
hook)post-checkout
: [optional] automatically update submodules when checkouting a branch (requires to define theAUTO_SUBMODULE_UPDATE
environment variable)
For easy setup:
current="$( pwd )" && cd "$( git rev-parse --show-cdup )" && if [ -d .hooks ]; then cd .hooks && git fetch origin && git reset --hard origin/master && cd ..; else git clone [email protected]:7358077.git .hooks; fi && if ([ ! -f .gitignore ] || ! grep .hooks .gitignore >/dev/null ); then echo -e ".hooks\n" >> .gitignore; fi && find .hooks -maxdepth 1 -type f | while read h; do chmod +x "${h}"; ln -s -f "../../${h}" "$(git rev-parse --git-dir)/hooks/$( basename ${h} )"; done && cd "${current}"