Skip to content

Instantly share code, notes, and snippets.

@sa-mm
sa-mm / master-push-check
Last active August 30, 2018 18:03 — forked from a-kinder/master-commit-check
Blocks push to master unless `-n` flag is provided
#!/bin/bash
# Stops accidental pushes to master. Adapted from https://gist.github.com/ColCh/9d48693276aac50cac37a9fce23f9bda
# Install in project:
# install or symlink at .git/hooks/pre-push
# chmod +x .git/hooks/pre-push
#!/bin/bash
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
@sa-mm
sa-mm / old-master-push-check
Created August 30, 2018 17:55
This is stolen from somewhere on the interwebs
#!/bin/bash
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
echo
if echo $REPLY | grep -E '^[Yy]$' > /dev/null
@sa-mm
sa-mm / .block
Created February 8, 2017 15:33 — forked from mbostock/.block
geo2svg
license: gpl-3.0
height: 1100
border: no
@sa-mm
sa-mm / .block
Last active February 7, 2017 21:14 — forked from mbostock/.block
AlbersUSA + PR
license: gpl-3.0