Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
5001cem-DomesticRepairs/prepare-commit-msg
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
39 lines (30 sloc)
921 Bytes
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
package.json | |
#!/bin/sh | |
# With thanks to Sergio Vaccaro <sergio.vaccaro@istat.it> | |
set -e # using the options command to abort script at first error | |
echo | |
echo "PREPARE-COMMIT-MSG" | |
# Branch to protect | |
PROTECTED_BRANCH="master" | |
# Remote | |
REMOTE="" | |
# Check for merges | |
if [[ $2 != 'merge' ]]; then | |
# Not a merge | |
ECHO " not a merge" | |
exit 0 | |
fi | |
# Current branch | |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
# Check if in PROTECTED_BRANCH | |
#if [[ "$CURRENT_BRANCH" != "$PROTECTED_BRANCH" ]]; then | |
# # Not in PROTECTED_BRANCH: can proceed | |
# ECHO " not in the ${PROTECTED_BRANCH} branch" | |
# exit 0 | |
#fi | |
echo " you are trying to merge into the ${PROTECTED_BRANCH} branch" | |
echo " merging branches to master must be done by creating a pull request" | |
echo " this merge has been cancelled however you will need to" | |
echo " reset the operation before continuing by running git reset --merge" | |
echo | |
exit 1 |