Skip to content

Instantly share code, notes, and snippets.

View dotfold's full-sized avatar

James McNamee dotfold

  • NVIDIA
  • Mountain View, CA
View GitHub Profile
@dotfold
dotfold / install-pre-commit.sh
Created October 5, 2017 22:48 — forked from stefansundin/install-pre-commit.sh
Git pre-commit check to stop accidental commits to master and develop branches. There is also a variant with a core.whitespace check.
#!/bin/sh
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are four variants that I have built:
# - pre-commit: stops commits to "master" and "develop" branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# Set desired version like this before installing:
# FILE=pre-commit