Created
July 7, 2013 13:59
-
-
Save narusemotoki/5943549 to your computer and use it in GitHub Desktop.
git push -nを行い、pushするコミットがあった場合いに、それらのログを表示します。
パスの通った場所にgitprepush.shを置き、実行権限を与えてください。
.gitconfigにprepush = "! gitprepush.sh"を書くとgit prepushと利用できるようになります。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Copyright (c), Naruse Motoki (motoki@naru.se) | |
# Licensed under The MIT License | |
dryrun=`git push -n 2>&1` | |
echo "$dryrun" | |
fromto=`echo $dryrun | sed -e "s/.* \([0-9a-z]\+\.\.[0-9a-z]\+\) .*/\1/g"` | |
if expr "$fromto" : "^[0-9a-z]\+\.\.[0-9a-z]\+$" >/dev/null; then | |
echo "`git log --date=short --pretty=format:"%h %ad %an %s" $fromto`" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment