Run ./setup.sh to set up git pre/post push hook scripts. Then, a similar script loaded to the environment will execute the pre/post push hook scripts: https://stackoverflow.com/a/3812238/1106893
For example loading this script and defining an alias like this will do the trick:
alias gpwh="git-push-with-hooks.sh"
Configure precommit as described in this blogpost: https://ljvmiranda921.github.io/notebook/2018/06/21/precommits-using-black-and-flake8/ Commands:
- Install precommit:
pip install pre-commit
- Make sure to add pre-commit to your path. For example, on a Mac system, pre-commit is installed here:
$HOME/Library/Python/3.8/bin/pre-commit
. - Execute
pre-commit install
to install git hooks in your.git/
directory.
In case you're facing a similar issue:
An error has occurred: InvalidManifestError:
=====> /<userhome>/.cache/pre-commit/repoBP08UH/.pre-commit-hooks.yaml does not exist
Check the log at /<userhome>/.cache/pre-commit/pre-commit.log
, please run: pre-commit autoupdate
More info here: pre-commit/pre-commit#577