From 6ade4d0dbc4d873d43764bcc20f69af5a2fe66b9 Mon Sep 17 00:00:00 2001 From: lhark Date: Sun, 7 Jun 2015 01:07:03 +0200 Subject: [PATCH] Finaly, fetch is alright, added push warning --- zshrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zshrc b/zshrc index f3fbd3a..432a788 100644 --- a/zshrc +++ b/zshrc @@ -15,7 +15,10 @@ export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin:~/bin # Mise à jour automatique à partir du repo distant cd /home/$USER/rc git fetch -if $(git status --porcelain -b 2> /dev/null | grep '^## .*behind' &> /dev/null); then +local gst=$(command git status --porcelain -b 2> /dev/null) +if $(echo "$gst" | grep '^## .*ahead' &> /dev/null); then + echo"You have unpushed business in /home/$USER/rc" +elif $(echo "$gst" | grep '^## .*behind' &> /dev/null); then echo "Type Y to update .zshrc: \c" read line if [ "$line" = Y ] || [ "$line" = y ]; then