Skip to content

Instantly share code, notes, and snippets.

@wxg4net
Created April 22, 2014 13:52
Show Gist options
  • Save wxg4net/11180087 to your computer and use it in GitHub Desktop.
Save wxg4net/11180087 to your computer and use it in GitHub Desktop.
git ptc for send email
#!/usr/bin/bash
num=1
if [ $# -gt 0 ]; then
num=$1
fi
git config --get core.email > /dev/null
if [ $? -ne 0 ]; then
exit 0
fi
glist=$(git diff --name-only HEAD HEAD~$num)
echo '准备附件...'
tar --ignore-failed-read -zcf /tmp/latest.tar.gz $(git diff --name-only HEAD HEAD~$num)
glog=$(git log --pretty=oneline --max-count=$num)
gfirst=$(git log --pretty="%s" --max-count=1)
gemail=$(git config --get core.email)
echo '准备邮件...'
echo "$glog" | mutt -s "修改:$gfirst" $gemail -a /tmp/latest.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment