How can I use husky to check a git commit message format?

With Husky 7+, you can add the following to .husky/commit-msg file: #!/usr/bin/env sh . “$(dirname — “$0″)/_/husky.sh” message=”$(cat $1)” requiredPattern=”^(add|cut|fix|bump|make|start|stop|refactor|reformat|optimise|document|merge) .*$” if ! [[ $message =~ $requiredPattern ]]; then echo “-” echo “-” echo “-” echo “🚨 Wrong commit message! 😕” echo “The commit message must have this format:” echo “<verb in imperative mood> <what … Read more

Are there any good workarounds to the GitHub 100MB file size limit for text files?

Clean and Smudge You can use clean and smudge to compress your file. Normally, this isn’t necessary, since git will compress it internally, but since gitHub is acting weird, it may help. The main commands would be like: git config filter.compress.clean gzip git config filter.compress.smudge gzip -d GitHub will see this as a compressed file, … Read more

How to run custom shell script file before pre commit hook

Here’s what you could do to use inline bash command as pre-commit hook entry – repo: local hooks: – id: pylint-error-count name: pylint-error-count entry: bash -c ‘lines=$(pylint api/ | wc -l) && (( lines > 10)) && exit 1’ language: system types: [python] pass_filenames: false You can also write a script and invoke it this … Read more

Where does pre-commit install “environments”?

The environments are installed into a cache: pre-commit by default places its repository store in ~/.cache/pre-commit — this can be configured in two ways: PRE_COMMIT_HOME: if set, pre-commit will use that location instead. XDG_CACHE_HOME: if set, pre-commit will use $XDG_CACHE_HOME/pre-commit following the XDG Base Directory Specification. disclaimer: I am the author

setup pre-commit hook jshint

There’s an easier way of doing pre-commit checks (e.g. JSHint) in your Node.js workflow: Install jshint from NPM: npm install jshint Next create a .jshintrc file in your project if you don’t already have one. e.g: https://github.com/nelsonic/learn-jshint/blob/master/.jshintrc Now install pre-commit module (and save it as a dev dependency): npm install pre-commit –save-dev Next you will … Read more

Git submodule commit hooks

If you have Git 2.10+ you can get the hooks directory by running: `git rev-parse –git-path hooks` Note: by default it is .git/hooks but if you are in a submodule it will be different. Pre Git 2.10+ you would want something like: `git rev-parse –git-dir`/hooks More info at: Find path to git hooks directory on … Read more

Enforce commit message format in git

As described in the Git ProBook “Customizing Git – An Example Git-Enforced Policy”, such enforcement would be set through a hook, more specifically, a server-side hook like an update one: All the server-side work will go into the update file in your hooks directory. The update hook runs once per branch being pushed and takes … Read more

Can I use a scripted commit template for git?

You probably want to set up a prepare-commit-msg hook on your local repository. It might look like this (say the branches are named ‘work-on-ticket-XXXX’: #!/bin/sh ORIG_MSG_FILE=”$1″ TEMP=`mktemp /tmp/git-XXXXX` TICKETNO=`git branch | grep ‘^\*’ | cut -b3-` (echo “Work on ticket #$TICKETNO”; cat “$ORIG_MSG_FILE”) > “$TEMP” cat “$TEMP” > “$ORIG_MSG_FILE” Put something like that (marked executable) … Read more

pre-commit/hook: No such file or directory

pre-commit hook runs first when you try to commit changes, it can be used to do certain checks, tests, conditions. In this case, clearly, you don’t have it, that’s why it’s complaining. Go to .git/hooks directory and remove pre-commit file, as its trying to reference to node_modules/pre-commit/hook. It should resolve it. Other option is append … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)