Last active
May 21, 2022 09:12
-
-
Save hata6502/d3bb634ec9beb9443a040c90733284bd to your computer and use it in GitHub Desktop.
git push して Twitter に通知します。
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/bash | |
url=`git config --get remote.origin.url` | |
domain=${url#*@} | |
domain=${domain#https://} | |
domain=${domain/:/} | |
branch=`git rev-parse --abbrev-ref HEAD` | |
tweet="" | |
if git rev-parse --verify origin/${branch} >/dev/null 2>&1 | |
then | |
remote=${branch} | |
else | |
remote=HEAD | |
fi | |
tweet="${tweet}https://${domain}/compare/`git rev-parse --short origin/${remote}`...`git rev-parse --short ${branch}`\n" | |
tweet="${tweet}`basename ${url}`/${branch} を更新しました。\n" | |
log=`git log --pretty=format:"・%s\n" origin/${remote}..${branch}` | |
tweet="${tweet}${log}" | |
if git push $@ | |
then | |
echo -e ${tweet} | tweet | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
スクリプトを「git-twitter」として保存することで、
gitwitter
ではなくgit twitter
としてコマンドを実行可能です。