Skip to content

Instantly share code, notes, and snippets.

@narusemotoki
Created July 7, 2013 13:59
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save narusemotoki/5943549 to your computer and use it in GitHub Desktop.
git push -nを行い、pushするコミットがあった場合いに、それらのログを表示します。 パスの通った場所にgitprepush.shを置き、実行権限を与えてください。 .gitconfigにprepush = "! gitprepush.sh"を書くとgit prepushと利用できるようになります。
#!/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