From b9767d94390bf96165d65a829d2aab37bda37258 Mon Sep 17 00:00:00 2001 From: typebrook Date: Thu, 18 Apr 2019 11:20:05 +0800 Subject: update --- scripts/check_upstream.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 scripts/check_upstream.sh (limited to 'scripts/check_upstream.sh') diff --git a/scripts/check_upstream.sh b/scripts/check_upstream.sh new file mode 100644 index 0000000..888061e --- /dev/null +++ b/scripts/check_upstream.sh @@ -0,0 +1,19 @@ +# check git repo $1 if upstream branch +# origin/master is ahead of local branch $2(default to dev) +check_upstream() { + + head='dev' + if [ $# -eq 2 ] + then + head=$2 + fi + + cd ~/$1 + git fetch origin && \ + git rev-list $head | grep $(git rev-parse origin/master) > /dev/null + + if [ $? -ne 0 ] + then + echo "New commit at" $1 + fi +} -- cgit v1.2.3-70-g09d2