kritzikratzi / git-forbid

Don't allow commits containing the word "git-forbid".

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Git-Forbid

A tiny git hook to stop you from committing text files containting the words git-forbid.

Originally based on https://www.emptypath.com/git_pre_commit_testing

Global Setup

Clone this repostory to ~/git-hooks and then run

git config --global core.hooksPath ~/git-hooks

Test it out

git init
echo "/* git-forbid */ \n#define somethingawefull" >testfile.txt
git add testfile.txt

# try to commit 
git commit

# Output: 
git-forbid messages found. 
-----------------------------
testfile.txt: /* git-forbid */
-----------------------------
Errors found, aborting commit. 
To fix this, edit and stage the files.
To ignore this error, use: git commit --no-verify

Disabling git-forbid for a single commit

Use can disable git hooks for a single command by using

git commit --no-verify

About

Don't allow commits containing the word "git-forbid".

License:Other


Languages

Language:Shell 100.0%