Skip to content

Instantly share code, notes, and snippets.

View bonniesimon's full-sized avatar
Confused , Frustrated and Caffeinated.☕

Bonnie Simon bonniesimon

Confused , Frustrated and Caffeinated.☕
View GitHub Profile
@bonniesimon
bonniesimon / Preventing push to master.md
Last active September 25, 2022 08:46
Added the necessary hooks to prevent push to master.

Create a file .husky/helpers/prevent_pushing_to_master.sh and add the following contents:

  #!/bin/sh
  
  prevent_pushing_to_master() {
    current_branch=`git symbolic-ref HEAD`
    current_origin=`git remote`
    if [ current_origin = "origin" -o "$current_branch" = "refs/heads/master" -o "$current_branch" = "refs/heads/master" ]
    then
    cat <<EOT