Skip to content

Instantly share code, notes, and snippets.

@Shrulik
Shrulik / pre-commit.sh
Last active November 29, 2016 14:13 — forked from intjonathan/pre-commit.sh
pre-commit hook (add to .git/hooks/pre-commit) to refuse to commit debugger strings. Note list of file extensions to see which files are conisdered.
#!/bin/sh
# Refuse to commit files with the string NOCOMMIT, debugger, or merge markers present.
#
files=$(git diff-index --name-status --cached HEAD | grep -v ^D | cut -c3-)
if [ "$files" != "" ]
then
for f in $files
do