Created
March 21, 2018 11:54
-
-
Save sergiandreplace/9591c8f307c4bd25bc795c5359eb6bf3 to your computer and use it in GitHub Desktop.
Pre-commit script for git. To save without extension
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/sh | |
local_branch=$(git rev-parse --abbrev-ref HEAD) | |
if [[ ! "$local_branch" == feature* ]] | |
then | |
echo 'Failed to push. Branch name should start by feature/' | |
exit 1 | |
fi | |
if [ "${#local_branch}" -ge 38 ] | |
then | |
echo 'Failed to push. Branch name could not be longer than 30 characters' | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment