Skip to content

Instantly share code, notes, and snippets.

@stouset
Created October 7, 2011 21:33
Show Gist options
  • Save stouset/1271397 to your computer and use it in GitHub Desktop.
Save stouset/1271397 to your computer and use it in GitHub Desktop.
Warn about unmerged branches
git branch -r | while read BRANCH; do
if [ `git incoming $BRANCH | wc -l` != 0 ]; then
AUTHOR=`git log $BRANCH -n 1 --format=format:%ae`
MESSAGE="You appear to be the person responsible for \`$BRANCH\`. It has unmerged commits. Can you take a second take make sure you still need it? If so, merge it when you can. If not, do a \`git push origin :${BRANCH#origin/}\`. Thanks."
echo -e $MESSAGE | mail -s "Possible stale branch" $AUTHOR
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment