Git Hooks Tutorial.
My public talk about this project at Sberloga: Git Hooks Is All You Need
mkdir git_repo
cd git_repo
git init
.git/hooks
folder:ls -lah .git/hooks
chmod +x
) pre-commit hooks (path: .git/hooks/pre-commit
):Make commit after each step. You'll see different results.
python3 -m venv venv
source venv/bin/activate
pip install pre-commit
pre-commit install
Create pre-commit configuration file .pre-commit-config.yaml. Alternatively, you can use local configuration.
Create main.py file.
Make commit. Pre-commit library will reformat file according to PEP8.
Remove unused import sys
string to get ready-to-commit main.py file.
git init --bare ../remote_repo.git
git remote add origin ../remote_repo.git
chmod +x
) pre-receive hook on "remote" (path: ../remote_repo.git/hooks/pre-receive
).Useful links:
Thanks to Anastasiya for help with jupyter notebook hooks!