Created
December 12, 2019 22:05
-
-
Save mgershovitz/e1c92f8ac7240237178c9b07e75d77bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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