Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.