Skip to content

Instantly share code, notes, and snippets.

@clairvy
Forked from narusemotoki/gitprepush.sh
Created December 16, 2013 06:08
Show Gist options
  • Save clairvy/7982957 to your computer and use it in GitHub Desktop.
Save clairvy/7982957 to your computer and use it in GitHub Desktop.
#!/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