Skip to content

Instantly share code, notes, and snippets.

@igrep
Created March 14, 2013 01:23
Show Gist options
  • Select an option

  • Save igrep/5158053 to your computer and use it in GitHub Desktop.

Select an option

Save igrep/5158053 to your computer and use it in GitHub Desktop.
Prevent you from committing on important branches.
#!/bin/bash
current_branch=$(git rev-parse --abbrev-ref HEAD)
warn_branch() {
echo "You can't commit on '$current_branch'!"
}
case $current_branch in
master) warn_branch; exit 1 ;; # Of cource you can add any other important branches as you need.
*) exit 0;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment