Skip to content

Instantly share code, notes, and snippets.

@tomnomnom
Created April 21, 2016 11:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tomnomnom/f6220a4cf1b37f3b2bd05a44a25f1c2b to your computer and use it in GitHub Desktop.
Save tomnomnom/f6220a4cf1b37f3b2bd05a44a25f1c2b to your computer and use it in GitHub Desktop.
Find out how much your branch sucks
#!/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