Skip to content

Instantly share code, notes, and snippets.

@voda
Created December 19, 2014 12:57
Show Gist options
  • Save voda/303fab064da6fa965cac to your computer and use it in GitHub Desktop.
Save voda/303fab064da6fa965cac to your computer and use it in GitHub Desktop.
#!/bin/bash
branch=$1
mergeBase=`git merge-base HEAD $branch`
if [ $? -ne 0 ]; then
exit $?
fi
while true; do
echo -n "Enter command (h for help): "
read command
case "$command" in
"l")
git log --oneline $mergeBase..$branch
;;
"t")
git diff --stat $mergeBase..$branch
;;
"s")
git show --reverse $mergeBase..$branch
;;
"d")
git diff --unified=4 --find-renames=50% $mergeBase..$branch
;;
"dw")
git diff -w $mergeBase..$branch
;;
"c")
git checkout $branch
exit
;;
"m")
git merge --no-ff $branch
exit
;;
"q")
exit
;;
*)
echo "Available commands:"
echo -e " h\tdisplay this help"
echo -e " l\tgit log"
echo -e " t\tgit diff --stat"
echo -e " s\tgit show"
echo -e " d\tgit diff"
echo -e " dw\tgit diff -w"
echo -e " c\tgit checkout"
echo -e " m\tgit merge --no-ff"
echo -e " q\tquit"
;;
esac
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment