From 413a2d5313bad1e067bdf47017aa32eb838b2577 Mon Sep 17 00:00:00 2001 From: RodrigoHahn Date: Tue, 1 Mar 2016 16:12:43 -0300 Subject: [PATCH] Now defaults to last commit if not provided For when you _really_ don't give a damn. --- git-blame-someone-else | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/git-blame-someone-else b/git-blame-someone-else index d76642c..33ee4b3 100644 --- a/git-blame-someone-else +++ b/git-blame-someone-else @@ -6,9 +6,16 @@ if [ $# -ne 2 ]; then fi AUTHOR=$1 + + +COMMIT_HASH=$2 +if [ "$2" = "--" ]; then + COMMIT_HASH=$(git log -n 1 --pretty=format:"%H") +fi + AUTHOR_NAME=$(echo $AUTHOR | perl -wlne '/^(.*)\s*<.*>$/ and print $1') AUTHOR_EMAIL=$(echo $AUTHOR | perl -wlne '/^.*\s*<(.*)>$/ and print $1') -COMMIT=$(git rev-parse --short $2) +COMMIT=$(git rev-parse --short $COMMIT_HASH) { GIT_SEQUENCE_EDITOR="sed -i -e 's/^pick $COMMIT/edit $COMMIT/'" git rebase -i $COMMIT~1^^