Skip to content

Instantly share code, notes, and snippets.

@rpetrich
Created May 23, 2013 20:42
Show Gist options
  • Save rpetrich/5639285 to your computer and use it in GitHub Desktop.
Save rpetrich/5639285 to your computer and use it in GitHub Desktop.
#!/bin/sh
# git-ticket-show by Ryan Petrich
if [ -e $1 ] ; then
echo "usage: git ticket-show <ticket>"
else
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
REVLIST=`git rev-list HEAD`
echo "Merge status of ticket $1 relative to $BRANCH:"
git log --all --no-merges --format=%H --grep="$1[:+]" | \
while read commit
do
if (grep -c $commit > /dev/null <<< "$REVLIST") ; then
MERGETEXT="%C(green)✓"
else
MERGETEXT="%C(red)×"
fi
git --no-pager show --color $commit --format="%n$MERGETEXT %H%Creset %ar by %C(yellow)%cN <%aE>%Creset%n %C(white)%s%Creset" | git name-rev --stdin
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment