Finaly, fetch is alright, added push warning

This commit is contained in:
lhark 2015-06-07 01:07:03 +02:00
parent 06cf29ecee
commit 6ade4d0dbc

5
zshrc
View file

@ -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