Skip to content

Instantly share code, notes, and snippets.

@mgershovitz
Created December 12, 2019 22:05
Show Gist options
  • Save mgershovitz/e1c92f8ac7240237178c9b07e75d77bc to your computer and use it in GitHub Desktop.
Save mgershovitz/e1c92f8ac7240237178c9b07e75d77bc to your computer and use it in GitHub Desktop.
#!/bin/bash
# Get the current branch name
branch_name=$(git branch | grep "*" | sed "s/\* //")
# if the merged branch was master - don't do anything
if [[ $branch_name = "master" ]]; then
echo "Preparing to merge to master..."
if git diff --cached | grep '^[+d].*NO_MERGE'; then
echo "Can't merge branch with 'NO_MERGE' comment, fix what you need and try again!"
exit 1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment