Last active
December 24, 2016 00:32
-
-
Save shouhei/c45422fc049ee827deb94bbbb2769fe2 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/sh | |
GIT_BRANCHES=`git branch | rev | cut -d ' ' -f1 | rev` | |
for BRANCH in $GIT_BRANCHES | |
do | |
if [[ $BRANCH =~ "-" ]]; then | |
printf "\e[31m$BRANCH does not keep naming rules.\e[m\n" | |
printf "\e[31mPlease check your branch naming.\e[m\n" | |
echo 'git branch -m $NEW $OLD' | |
exit 1 | |
fi | |
done | |
printf -e "\e[32mAll branch name are fine.\e[m\n" | |
exit 0 |
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 | |
GIT_BRANCHES=`git branch | rev | cut -d ' ' -f1 | rev` | |
for BRANCH in $GIT_BRANCHES | |
do | |
if [[ $BRANCH =~ "-" ]]; then | |
git branch -m $BRANCH ${BRANCH/-/_} | |
fi | |
done | |
printf "\e[32mAll branch name are fine.\e[m\n" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment