Skip to content

Pre-commit hooks (git)

1. Go to .git/hooks
2. remove the word sample from the pre-push file
3. Add following code to detect console logs in files you want to push

console() {
	git diff --cached --name-only origin | grep -E $FILES_PATTERN | GREP_COLOR='4;5;37;41' xargs grep --color --with-filename -n $FORBIDDEN | xargs echo && echo 'COMMIT REJECTED Found' $FORBIDDEN 'references. Please remove them before commiting' && exit 1

exit $?
Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *