Created
November 22, 2013 10:20
-
-
Save romanofski/7597771 to your computer and use it in GitHub Desktop.
git post-checkout hook, which does $foo when you switch to a branch with a 'bug_XXXX' in the name.
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 | |
# | |
# Rename to `post-checkout`, make it executable and stick it into .git/hooks/ | |
# | |
PREVIOUS_HEAD=$1 | |
NEW_HEAD=$2 | |
BRANCH_SWITCH=$3 | |
NEW_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
if [[ $NEW_BRANCH =~ bug_[[:digit:]]+ ]] | |
then | |
echo "Working on bug: $NEW_BRANCH" | |
else | |
echo "Ignored" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment