Skip to content

Instantly share code, notes, and snippets.

View matan7890's full-sized avatar

Matan Merom matan7890

View GitHub Profile
@matan7890
matan7890 / pre-commit
Created July 10, 2022 14:59
git pre-commit hook for lint-checking
#!/bin/sh
# Place me in ".git/hooks", replacing the original file if one exists.
# Stashing all non-staged changes so the lint will only run on staged changes.
# Assuming the already-commited code is always linted before commiting,
# this code assures that the upcoming commits will also be linted.
git stash -k -u > /dev/null
# This code assumes here you have some `make` commands for checking/reporting/fixing the linting of the code.
# You can change these to the commands of your choice.