Created
April 21, 2016 11:38
-
-
Save tomnomnom/f6220a4cf1b37f3b2bd05a44a25f1c2b to your computer and use it in GitHub Desktop.
Find out how much your branch sucks
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 | |
set -e | |
BRANCH=${1} | |
if [ -z "${BRANCH}" ]; then | |
echo "Usage: ${0} <branch>" | |
exit 1 | |
fi | |
COMMITS_BEHIND=$(git log origin/master --not origin/${BRANCH} --no-merges --oneline | wc -l) | |
echo "${BRANCH} is ${COMMITS_BEHIND} commits behind master" | |
if [ "${COMMITS_BEHIND}" -gt "1000" ]; then | |
echo "GET IN THE FUCKING SEA." | |
exit 2 | |
elif [ "${COMMITS_BEHIND}" -gt "100" ]; then | |
echo "That's bad, and you should feel bad." | |
exit 3 | |
elif [ "${COMMITS_BEHIND}" -gt "50" ]; then | |
echo "That's pretty poor to be honest." | |
exit 4 | |
elif [ "${COMMITS_BEHIND}" -gt "10" ]; then | |
echo "That's not *too* bad." | |
else | |
echo "Well done, you." | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment