Skip to content

Instantly share code, notes, and snippets.

@visualjeff
Last active October 20, 2022 00:08
Show Gist options
  • Save visualjeff/36fa03d1c8d700c07c883628a7d84176 to your computer and use it in GitHub Desktop.
Save visualjeff/36fa03d1c8d700c07c883628a7d84176 to your computer and use it in GitHub Desktop.
pre-commit setup
Pre-req's:
Python 3
A project that is git initialized
Windozs setup:
pip install pre-commit
MAC OS setup for pre-commit:
brew install pre-commit
Project setup:
git config --unset-all core.hooksPath
pre-commit install
Create the .pre-commit-config.yaml file at the root of your project with the following content:
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: check-json
- id: check-case-conflict
- id: check-merge-conflict
- id: mixed-line-ending
Manually test your pre-commit:
pre-commit run --all-files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment