Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mrubens on github.
  • I am mrubens (https://keybase.io/mrubens) on keybase.
  • I have a public key whose fingerprint is FCEE 6C84 C7F0 E0F1 4E49 0197 38AE 8A5A B815 07D8

To claim this, I am signing this object:

@mrubens
mrubens / pre-push
Created April 9, 2014 15:44
A pre-push hook to prevent running destructive commands on master
# Steps to install this in a single repo
# 1. Copy this file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
#
# Steps to install this for multiple repos
# 1. Enable git templates: `git config --global init.templatedir '~/.git-templates'`
# 2. Create a directory to hold the global hooks: `mkdir -p ~/.git-templates/hooks`
# 3. Copy this file to `~/.git-templates/hooks/pre-push`
# 4. Set executable permissions, run `chmod +x ~/.git-templates/hooks/pre-push`
# 5. Run `git init` in every repo that you want to add this hook to (it will get automatically added to newly cloned repos)